body[data-view="canvas"] .top-nav,body[data-view="canvas"] .user-watermark { display:none; }
#canvasView.active { display:block; position:fixed; inset:0; width:100%; max-width:none; height:100dvh; padding:0; margin:0; z-index:30; }
.canvas-head { position:absolute; top:max(16px,env(safe-area-inset-top)); left:16px; right:16px; display:flex; align-items:center; gap:16px; z-index:8; pointer-events:none; }
.canvas-head > * { pointer-events:auto; }
.canvas-title { display:flex; align-items:center; gap:12px; padding:5px 16px 5px 5px; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 3px 12px #00000008; }
.canvas-head h1 { margin:0; font-size:18px; font-weight:700; letter-spacing:-.4px; }
.canvas-title button,.canvas-file-actions button,.canvas-file-actions summary,.canvas-zoom button { display:flex; align-items:center; justify-content:center; border:1px solid var(--line); background:var(--surface); color:var(--text); border-radius:8px; padding:0 14px; min-height:42px; font-size:13px; cursor:pointer; }
.canvas-title button { border:0; padding:0 10px; }
#canvasSaveStatus { margin-left:auto; font-size:12px; color:var(--muted); background:var(--surface); padding:8px 12px; border-radius:8px; }
.canvas-file-actions { display:flex; gap:8px; position:relative; }
#canvasSave { background:var(--primary); color:#171717; border-color:var(--primary); font-weight:650; }
#canvasFiles { position:relative; }
#canvasFiles summary { list-style:none; }
#canvasFiles summary::-webkit-details-marker { display:none; }
#canvasFiles > div { position:absolute; top:50px; right:0; width:140px; padding:6px; display:grid; gap:4px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:var(--shadow-soft); }
#canvasFiles button { border:0; width:100%; }
.canvas-shell { position:absolute; inset:0; overflow:hidden; background:var(--bg); }
.canvas-tools { position:absolute; left:16px; top:94px; z-index:5; display:flex; flex-direction:column; gap:4px; padding:6px; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 3px 12px #00000008; max-height:calc(100% - 180px); overflow:auto; }
.canvas-tools button { display:flex; align-items:center; gap:10px; min-height:42px; padding:0 12px; border:0; background:transparent; color:var(--text); border-radius:8px; white-space:nowrap; font-size:12px; }
.canvas-tools button:hover { background:var(--surface-2); color:var(--primary-dark); }
.canvas-tools svg,.canvas-file-actions svg,.canvas-title svg,#canvasAddButton svg { width:18px; height:18px; }
.tool-divider { height:1px; background:var(--line); margin:4px 8px; }
.canvas-viewport { position:absolute; inset:0; overflow:hidden; touch-action:none; background-color:var(--bg); background-image:radial-gradient(var(--line) 1px,transparent 1px); background-size:24px 24px; outline-offset:-4px; cursor:grab; -webkit-touch-callout:none; }
.canvas-viewport:active { cursor:grabbing; }
.canvas-world { position:absolute; top:0; left:0; width:0; height:0; transform-origin:0 0; will-change:transform; }
.canvas-edges { position:absolute; width:1px; height:1px; overflow:visible; pointer-events:none; color:var(--primary); }
.canvas-edges > path { fill:none; stroke:var(--primary); stroke-width:2; opacity:.65; }
.canvas-node { position:absolute; width:260px; min-height:176px; background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:14px; box-shadow:0 5px 16px #00000008; cursor:default; outline:0; }
.canvas-node.selected,.canvas-node:focus-visible { outline:2px solid var(--primary); outline-offset:2px; z-index:2; }
.canvas-node.connecting { outline:2px dashed var(--primary); }
.canvas-node header { display:flex; align-items:center; gap:8px; border-bottom:1px solid var(--line); min-height:46px; padding:10px 14px; cursor:move; user-select:none; }
.canvas-node header svg { width:16px; height:16px; stroke-width:1.8; fill:none; flex-shrink:0; color:var(--primary); }
.canvas-node header strong { font-size:12px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.canvas-node header small { display:none; }
.canvas-node-body { padding:16px; display:grid; gap:10px; overflow:hidden; border-radius:0 0 14px 14px; }
.canvas-node-body p { margin:0; font-size:13px; line-height:1.7; overflow-wrap:anywhere; }
.canvas-node-body .node-text { white-space:pre-wrap; max-height:150px; overflow:auto; }
.canvas-node-body small { color:var(--muted); font-size:11px; line-height:1.6; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.canvas-node-body button { min-height:34px; border:1px solid var(--line); color:var(--text); background:var(--surface-2); border-radius:7px; font-size:12px; }
.canvas-node-body img,.canvas-node-body video { width:100%; max-height:180px; object-fit:contain; border-radius:8px; }
.node-placeholder { min-height:72px; display:grid; place-content:center; text-align:center; color:var(--muted); }
.node-pending { font-size:10px; color:var(--muted); background:var(--surface-2); padding:5px 8px; border-radius:5px; justify-self:start; }
.node-port { position:absolute; top:76px; width:24px; height:24px; border:0; background:transparent; border-radius:50%; padding:0; z-index:3; }
.node-port::after { content:''; position:absolute; inset:6px; border:2px solid var(--primary); border-radius:50%; background:var(--surface); }
.node-port:hover::after { background:var(--primary); }
.port-in { left:-13px; }.port-out { right:-13px; }
.canvas-empty { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:32px; text-align:center; cursor:default; pointer-events:none; }
.canvas-empty button { pointer-events:auto; min-height:44px; font-size:13px; margin:14px 0; padding:0 20px; border-radius:10px; }
.canvas-empty-mark { font-size:44px; color:var(--primary); font-weight:300; }
.canvas-empty h2 { font-size:32px; font-weight:600; letter-spacing:-1px; margin:16px 0 8px; }
.canvas-empty p { font-size:13px; color:var(--muted); line-height:1.7; margin:0; max-width:360px; }
.canvas-empty small { font-size:11px; color:var(--muted); }
.canvas-zoom { position:absolute; bottom:max(18px,env(safe-area-inset-bottom)); right:18px; display:flex; align-items:center; gap:3px; border:1px solid var(--line); padding:4px; background:var(--surface); border-radius:11px; box-shadow:0 4px 12px #00000005; cursor:default; z-index:3; }
.canvas-zoom button { border:0; min-width:34px; padding:0 10px; }
.canvas-zoom button:hover { background:var(--surface-2); }
.canvas-zoom output { font-size:11px; min-width:42px; text-align:center; font-variant-numeric:tabular-nums; color:var(--muted); }
.canvas-inspector { position:absolute; top:94px; right:16px; width:280px; max-height:calc(100% - 180px); display:flex; flex-direction:column; gap:18px; background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:14px; padding:18px; overflow:auto; z-index:4; box-shadow:var(--shadow-soft); }
.canvas-inspector header { display:flex; align-items:center; justify-content:space-between; }
.canvas-inspector header strong { font-size:13px; }
.canvas-inspector button { min-height:36px; border:1px solid var(--line); border-radius:7px; background:var(--surface-2); color:var(--text); font-size:12px; padding:0 10px; }
.canvas-inspector label { display:grid; gap:8px; color:var(--muted); font-size:12px; }
.canvas-inspector input,.canvas-inspector textarea,.canvas-inspector select { min-width:0; width:100%; min-height:38px; padding:9px 10px; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--text); font-size:13px; resize:vertical; }
.canvas-inspector small { font-size:11px; color:var(--muted); }
.canvas-upload input { font-size:11px; }
.generation-status { background:var(--bg); border-radius:10px; padding:12px; }
.generation-status strong { font-size:12px; }
.generation-status p { font-size:11px; color:var(--muted); line-height:1.7; }
.generation-status button { width:100%; }
.node-connections { display:grid; gap:8px; }
.node-connections strong { font-size:12px; }
.node-connections > div { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; }
.node-connections span { white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
.inspector-actions { display:flex; gap:5px; flex-wrap:wrap; }
.inspector-actions .danger { color:var(--danger); }

#canvasAddButton { display:none; }
.canvas-context-menu { position:absolute; z-index:12; width:232px; padding:7px; background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 40px #00000026; max-height:calc(100dvh - 100px); overflow:auto; }
.canvas-context-menu header { display:flex; align-items:center; justify-content:space-between; padding:0 6px; font-size:12px; color:var(--muted); }
.canvas-context-menu button { display:flex; align-items:center; gap:10px; min-height:42px; width:100%; padding:0 12px; border:0; border-radius:7px; background:transparent; color:var(--text); font-size:13px; text-align:left; }
.canvas-context-menu header button { width:40px; font-size:20px; justify-content:center; }
.canvas-context-menu button:hover,.canvas-context-menu button:focus-visible { background:var(--surface-2); color:var(--primary-dark); }
.canvas-context-menu svg { width:18px; height:18px; color:var(--primary-dark); }
.canvas-context-menu small { margin-left:auto; font-size:10px; color:var(--muted); }
@media(max-width:720px) {
 .canvas-head { top:max(10px,env(safe-area-inset-top)); left:10px; right:10px; gap:8px; }
 .canvas-title { gap:3px; padding:3px 10px 3px 3px; }
 .canvas-head h1 { font-size:15px; white-space:nowrap; }
 #canvasSaveStatus { position:absolute; top:58px; right:0; margin:0; font-size:10px; padding:5px 8px; }
 .canvas-file-actions { margin-left:auto; gap:5px; }
 .canvas-file-actions button,.canvas-file-actions summary { min-height:44px; padding:0 11px; font-size:12px; }
 .canvas-tools { display:none; }
 #canvasAddButton { display:flex; align-items:center; gap:5px; position:absolute; bottom:max(14px,env(safe-area-inset-bottom)); left:10px; min-height:46px; border:0; border-radius:10px; background:var(--primary); color:#171717; padding:0 12px; font-size:13px; font-weight:650; z-index:5; }
 .canvas-empty { padding:24px; }
 .canvas-empty h2 { font-size:26px; }
 .canvas-empty p { font-size:12px; }
 .canvas-empty small { font-size:10px; }
 .canvas-zoom { bottom:max(14px,env(safe-area-inset-bottom)); right:10px; gap:0; padding:2px; }
 .canvas-zoom button { min-height:40px; min-width:32px; padding:0 6px; font-size:11px; }
 .canvas-zoom output { min-width:35px; }
 .canvas-inspector { top:auto; bottom:76px; right:10px; left:10px; width:auto; max-height:50%; padding:14px; gap:12px; }
 .canvas-inspector input,.canvas-inspector textarea,.canvas-inspector select { font-size:16px; }
 .canvas-inspector button { min-height:44px; }
 .canvas-context-menu { left:10px!important; right:10px; top:auto!important; bottom:76px; width:auto; }
 .canvas-context-menu > button { min-height:46px; }
}
