.canvas-page { color-scheme: light; background: #fff; color: #17263b; --text: #17263b; --muted: #5c6d84; --line: #dbe4ef; --surface: #fff; --surface-raised: #f5f8fd; --accent: #1856d8; --focus: #397af1 }
.canvas-page .topbar { background: #fff; border-color: #e1e9f3 }
.canvas-page .brand small { color: #5c6d84 }
.canvas-page .brand-mark::after { background: #78a6ff }
.canvas-page .site-main { width: 100%; max-width: 1680px; padding: 22px clamp(14px, 3vw, 44px) 0 }
.canvas-page .secondary:hover:not(:disabled) { background: #ebf2fc }
.canvas-page #works .work-card { background: #fff }
.canvas-page #works .filter.active { color: #164ba9; background: #e7efff }
.canvas-page dialog { background: #fff; color: #17263b; border-color: #dbe4ef }
.canvas-page input:not([type=file]), .canvas-page textarea, .canvas-page select { background: #fff; color: #17263b; border-color: #cdd9e9 }
.canvas-page .field { color: #334761 }
.canvas-header { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 15px }
.canvas-header h1 { margin: 5px 0 3px; font-size: clamp(24px, 3vw, 35px); letter-spacing: -.05em }
.canvas-header p, .canvas-service { color: #5c6d84; font-size: 13px }
.canvas-service { text-align: right }
.editor-surface { border: 1px solid #d9e4f1; border-radius: 13px; background: #fff; overflow: hidden }
.editor-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid #dbe4ef; gap: 8px }
.editor-toolbar-group, .node-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px }
.canvas-button { display: inline-flex; gap: 6px; justify-content: center; align-items: center; padding: 6px 11px; min-height: 34px; color: #263c58; background: #fff; border: 1px solid #d2dfee; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer }
.canvas-button:hover:not(:disabled) { background: #f0f6ff; border-color: #9dbbf1 }
.canvas-primary { color: #fff; border-color: #1e59d9; background: #1e59d9 }
.canvas-primary:hover:not(:disabled) { color: #fff; border-color: #174cc1; background: #174cc1 }
#canvas-board { position: relative; height: clamp(520px, 68vh, 850px); overflow: hidden; isolation: isolate; background: radial-gradient(circle, #cfdaea 1px, transparent 1.25px) 0 0 / 20px 20px, #fbfdff; cursor: grab; touch-action: none }
#canvas-board.is-dragging { cursor: grabbing; user-select: none }
#canvas-board.is-wiring { cursor: crosshair; user-select: none }
#canvas-world, #canvas-wires { position: absolute; inset: 0; pointer-events: none; transform-origin: 0 0 }
#canvas-wires { width: 100%; height: 100% }
.canvas-controls { display: flex; position: absolute; left: 12px; bottom: 12px; z-index: 3; gap: 4px; align-items: center; border: 1px solid #dbe4ef; background: #fff; padding: 4px; border-radius: 8px; box-shadow: 0 3px 14px #193e7310; cursor: auto }
.canvas-controls button { padding: 5px 8px; background: #fff; border: 0; border-radius: 5px; color: #264666 }
.canvas-controls button:hover { background: #edf4ff }
.canvas-controls output { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; font-size: 12px }
.canvas-foot { display: flex; justify-content: space-between; gap: 10px; padding: 9px 14px; border-top: 1px solid #dbe4ef; color: #5c6d84; font-size: 12px }
.graph-card { position: absolute; width: 284px; border: 1px solid #cddcec; background: #fff; border-radius: 11px; box-shadow: 0 5px 22px #24487312; pointer-events: auto; cursor: auto }
.graph-card[data-kind=source] { width: 350px }
.graph-card[data-kind=frame] { width: 214px }
.graph-card-head { display: flex; align-items: center; gap: 8px; min-height: 41px; padding: 6px 11px; background: #f6f9fe; border-radius: 10px 10px 0 0; border-bottom: 1px solid #e1e9f3; cursor: grab; font-size: 13px; touch-action: none }
.graph-card-head strong { flex: 1 }
.graph-card-head .pet { width: 22px; height: 19px; border-width: 2px }
.graph-card-head .pet::before { height: 8px; top: -2px }
.graph-card-head .pet::after { width: 3px; height: 3px; left: 5px; top: 7px; box-shadow: 9px 0 #1b4657 }
.graph-card-head button { background: transparent; border: 0; color: #526886; padding: 3px 5px; border-radius: 4px; font-size: 12px }
.graph-card-head button:hover { background: #e5edfb }
.graph-body { padding: 11px; display: grid; gap: 8px; min-width: 0 }
.graph-body textarea { min-height: 64px; font-size: 12px; padding: 8px }
.graph-body p, .graph-body summary, .graph-body small { font-size: 12px; color: #5c6d84; overflow-wrap: anywhere }
.graph-body details textarea { margin-top: 6px }
.graph-body summary { cursor: pointer }
.graph-body img, .graph-body video { width: 100%; display: block; object-fit: contain; max-height: 225px; border-radius: 6px; background: #edf3fa }
.graph-body video { aspect-ratio: 16/9; background: #182539 }
.graph-empty-video { display: grid; place-items: center; min-height: 158px; border: 1px dashed #afc4df; background: #f5f9ff; border-radius: 7px; color: #536c89; cursor: pointer }
.graph-empty-video:hover, .graph-empty-video.drag-over { border-color: #2262db; background: #eaf2ff }
.frame-preview { border: 0; background: none; padding: 0; display: block; width: 100% }
.frame-preview:hover { outline: 2px solid #387af0; border-radius: 6px }
.graph-timeline { width: 100%; accent-color: #2467df; margin: 0 }
.graph-transport { display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums }
.graph-transport .canvas-button { padding: 5px 7px; min-height: 30px }
.graph-transport input[type=number] { width: 67px; min-width: 0; padding: 4px 5px; font-size: 12px }
.graph-transport small { flex: 1; white-space: nowrap }
.graph-source-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.graph-port { position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #acc4ec; background: #fff; color: #245fcb; padding: 0; top: 52px; display: grid; place-items: center; cursor: crosshair; z-index: 2 }
.graph-port[data-direction=in] { left: -10px }
.graph-port[data-direction=out] { right: -10px; color: white; border-color: #2868df; background: #2868df }
.graph-port.active, .graph-port.target, .graph-port:hover { outline: 5px solid #d0e1ff; border-color: #155ad5; background: #155ad5; color: white }
.graph-inputs { padding: 7px 8px; background: #f1f6ff; border-radius: 5px; min-height: 30px }
.graph-inputs button { color: #245fcb; background: none; border: 0; margin-left: 4px; padding: 0; text-decoration: underline }
.graph-result { display: grid; gap: 7px }
.graph-result p, .graph-error { color: #8d3d26 }
@media(max-width:700px) { .canvas-header, .canvas-foot { align-items: start; flex-direction: column } .canvas-service { text-align: left } #canvas-board { height: 64vh; min-height: 510px } }

.graph-card[data-kind=frame] { width: 198px; border-radius: 7px; box-shadow: none }
.graph-card[data-kind=frame] .graph-card-head { background: #fff; border: 0; border-radius: 7px; min-height: 31px; padding: 4px 7px; font-size: 11px }
.graph-card[data-kind=frame] .graph-body { padding: 0 5px 5px }
.graph-card[data-kind=frame] img { max-height: 165px }
.graph-card[data-kind=frame] .graph-port { top: 42px }
.graph-card[data-kind=assistant] { background: #f5f8ff; border-color: #93aff4; box-shadow: 0 8px 30px #325de42b }
.graph-card[data-kind=assistant] .graph-card-head { background: linear-gradient(115deg, #18265d, #2c4dba 62%, #435de0); color: #fff; border: 0; min-height: 60px; padding: 9px 11px }
.graph-card[data-kind=assistant] .graph-card-head button { color: #fff; background: #ffffff18 }
.graph-card[data-kind=assistant] .graph-card-head button:hover { background: #ffffff35 }
.graph-card[data-kind=assistant] .graph-port { top: 69px }
.assistant-emblem { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; color: #fff; font-size: 23px; background: radial-gradient(circle at 25% 20%, #9aefff, #5275e7 68%); box-shadow: 0 0 16px #88caff7a }
.assistant-rank { display: block; margin-top: 2px; font-size: 10px; color: #d8e8ff; font-weight: 500; letter-spacing: .04em }
.wire-cut { position: absolute; z-index: 4; transform: translate(-50%, -50%); width: 23px; height: 23px; padding: 0; border: 1px solid #efaeb2; border-radius: 50%; background: #fff; color: #bb2b38; cursor: pointer; font-size: 17px; line-height: 1 }
.wire-cut:hover { background: #fae6e8 }
.graph-progress { width: 100%; height: 7px; accent-color: #215bd7 }
.graph-revise { display: grid; gap: 6px; padding-top: 7px; border-top: 1px solid #dbe4ef }
.graph-result-message:empty { display: none }
.graph-video-stage { display: grid; gap: 7px }
.graph-video-stage video { cursor: pointer }
.graph-video-stage > .canvas-button { justify-self: end; min-height: 28px }
.graph-transport { flex-wrap: wrap }
#video-zoom-dialog { width: min(1080px, calc(100% - 28px)); max-width: none; max-height: calc(100dvh - 28px); overflow: auto; padding: 13px; border-radius: 12px }
#video-zoom-dialog .video-zoom-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 9px }
#video-zoom-dialog video { width: 100%; max-height: 64vh; background: #182539; display: block; border-radius: 7px }
#video-zoom-dialog .graph-video-stage > .canvas-button { display: none }
#video-zoom-dialog .graph-transport { justify-content: center }
#video-zoom-dialog .graph-transport small { flex: 0 auto }
#video-zoom-status { color: #456384; font-size: 12px; margin: 7px 0 0 }
.depth-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 7px }
.depth-settings label { color: #5c6d84; font-size: 11px }
.depth-settings input { margin-top: 3px; padding: 5px 7px }
.wan-settings label { display: grid; gap: 4px }
.wan-settings select { width: 100%; min-width: 0; min-height: 32px; padding: 4px 6px }
.video-compose { display: grid; gap: 8px; min-width: 0 }
.video-compose-reference .canvas-button { min-height: 28px; padding: 3px 8px; font-size: 11px }
.video-compose-tools { display: flex; align-items: end; gap: 7px }
.video-compose-tools label { display: grid; gap: 3px; flex: 1; font-size: 11px; color: #5c6d84 }
.video-compose-tools select { width: 100%; padding: 5px 7px; min-height: 34px }
.video-compose-tools > button { color: #1e55c3; background: #eef4ff }
.video-options > summary { padding: 5px 1px; font-variant-numeric: tabular-nums }
.video-options .depth-settings, .video-options .node-actions { padding-top: 6px }
.video-connect-option { display: grid; width: 100%; gap: 2px; justify-content: start; text-align: left; padding: 10px 12px; margin-top: 8px }
.video-connect-option small { color: #52647b; font-weight: 400 }
.video-duration-slider, .video-duration-hint { grid-column: 1 / -1 }
.wan-settings .video-duration-slider input { width: 100%; margin: 0; padding: 0; accent-color: #215bd7 }
.video-task-status { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; color: #5c6d84; overflow-wrap: anywhere }
.video-task-status strong { flex: none; color: #215bd7; font-variant-numeric: tabular-nums }

.canvas-commandbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 7px 14px; border-bottom: 1px solid #dbe4ef }
.canvas-commandbar .canvas-button { min-height: 28px; padding: 4px 8px; font-size: 11px }
.canvas-commandbar .canvas-button[aria-pressed=true] { border-color: #397af1; color: #194fb4; background: #eaf2ff }
#canvas-selection { color: #4b6180; font-size: 12px }
#canvas-selection-tools { display: flex; flex-wrap: wrap; gap: 6px }
#canvas-board.select-mode { cursor: crosshair }
#canvas-marquee { position: absolute; z-index: 3; pointer-events: none; border: 1px solid #3071e8; background: #387bf022 }
.graph-card.is-selected { outline: 2px solid #3c7cf0; outline-offset: 2px }
.graph-body audio { width: 100%; min-width: 0 }
.canvas-groups { position: absolute; inset: 0; pointer-events: none }
.canvas-group-box { position: absolute; border: 1px solid #9bb8ea; background: #d6e5ff36; border-radius: 12px; pointer-events: none }
.canvas-group-box button { pointer-events: auto; min-height: 22px; margin: 2px 8px; padding: 1px 6px; background: #edf4ff; font-size: 10px }
.canvas-menu { position: absolute; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: min(284px, calc(100% - 8px)); padding: 8px; background: #fff; border: 1px solid #dbe4ef; border-radius: 9px; box-shadow: 0 10px 30px #20396324 }
.canvas-menu .canvas-button { justify-content: flex-start; white-space: normal }
#canvas-map { position: absolute; right: 12px; bottom: 12px; width: 132px; height: auto; border: 1px solid #dbe4ef; border-radius: 8px; background: #fff; cursor: crosshair; z-index: 2 }
#canvas-project-dialog, #canvas-assets-dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 34px); overflow: auto; padding: 15px }
.canvas-project-actions { margin: 9px 0 }
#canvas-project-message { margin: 8px 0; color: #4b6180; font-size: 12px }
#canvas-project-list, #canvas-flow-list { display: grid; gap: 5px; max-height: 190px; overflow: auto }
#canvas-project-list .canvas-button, #canvas-flow-list .canvas-button { justify-content: flex-start }
#canvas-asset-list { display: grid; gap: 6px; margin-top: 10px }
.canvas-asset-row { display: flex; align-items: center; gap: 7px; padding: 7px; border: 1px solid #dbe4ef; border-radius: 7px }
.canvas-asset-row img { width: 48px; height: 34px; object-fit: cover; border-radius: 4px }
.canvas-asset-row span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px }
@media (max-width: 700px) { #canvas-map { width: 90px } }

.standalone-canvas { overflow: hidden }
.standalone-canvas #edit-view { height: 100dvh }
.standalone-canvas .editor-surface {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.workspace-top { grid-row: 1; min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 22px; border-bottom: 1px solid #e3e9f2; z-index: 4 }
.workspace-identity, .workspace-project-tools { display: flex; align-items: center; gap: 8px; min-width: 0 }
.workspace-identity h1 { font-size: 15px; letter-spacing: -.02em; font-weight: 650; white-space: nowrap }
.canvas-home { margin-right: 4px }
.canvas-home .brand-mark { width: 23px; height: 18px }
.standalone-canvas #canvas-board { grid-row: 2; height: auto; min-height: 0; background: radial-gradient(circle, #cbd6e7 1px, transparent 1.25px) 0 0 / 24px 24px, #f7f9fc }
.standalone-canvas .canvas-commandbar { grid-row: 4; justify-content: center; border-top: 1px solid #e3e9f2; border-bottom: 0; padding: 9px 14px; position: relative; z-index: 5 }
.workspace-divider { height: 24px; width: 1px; background: #e3e9f2; margin: 0 3px }
.standalone-canvas .canvas-button { border-radius: 8px; transition: background-color .14s, border-color .14s, box-shadow .14s, transform .12s }
.standalone-canvas .canvas-button:not(.canvas-primary) { border-color: #e1e7f0 }
.standalone-canvas .canvas-button:hover:not(:disabled) { box-shadow: 0 2px 7px #1837600e }
.standalone-canvas .canvas-button:active:not(:disabled), .canvas-controls button:active { transform: translateY(1px) scale(.98) }
.standalone-canvas .canvas-commandbar .canvas-button, .workspace-project-tools .canvas-button { min-height: 34px; font-size: 12px }
.workspace-icon { min-width: 34px; padding: 4px 7px; font-size: 16px !important; line-height: 1 }
.workspace-more { position: relative }
.workspace-more summary { list-style: none }
.workspace-more summary::-webkit-details-marker { display: none }
.workspace-popover { position: absolute; z-index: 8; right: 0; bottom: calc(100% + 10px); display: grid; gap: 3px; min-width: 154px; padding: 6px; background: #fff; border: 1px solid #e0e8f3; border-radius: 11px; box-shadow: 0 9px 26px #112b5224 }
.workspace-popover .canvas-button { justify-content: flex-start; border: 0; white-space: nowrap }
.workspace-selection { grid-row: 3; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px; padding: 7px 12px; background: #f5f8fe; border-top: 1px solid #e3e9f2 }
.workspace-selection .canvas-button { min-height: 28px; padding: 3px 8px; font-size: 11px }
.standalone-canvas .canvas-foot { grid-row: 5; border-color: #edf0f6; min-height: 32px; align-items: center; padding: 6px 16px; font-size: 11px }
.standalone-canvas #canvas-ai-status { flex: none }
.standalone-canvas .graph-card { border-color: #d5deec; border-radius: 13px; box-shadow: 0 4px 14px #142f570e }
.standalone-canvas .graph-card-head { border-radius: 12px 12px 0 0 }
.standalone-canvas .graph-card.is-selected { outline-width: 1px; box-shadow: 0 0 0 4px #3980ff1a, 0 8px 25px #1d478c19 }
.standalone-canvas .canvas-menu { border-radius: 12px; padding: 10px; width: min(316px, calc(100% - 8px)); max-height: calc(100% - 8px); overflow: auto; cursor: default }
.canvas-menu-title { grid-column: 1 / -1; color: #5c6d84; font-size: 11px; padding: 4px 5px }
.canvas-welcome { position: absolute; inset: 0; z-index: 4; overflow: auto; display: grid; place-items: center; padding: clamp(14px, 4vw, 56px); cursor: default; touch-action: pan-y; background: #f8faff; }
.welcome-content { width: min(100%, 1140px); margin-block: auto; display: grid; gap: clamp(16px, 3vw, 30px); }
.welcome-art { width: 100%; height: auto; border-radius: 16px; border: 1px solid #dbe6f7; box-shadow: 0 16px 46px #24487314; }
.welcome-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.welcome-actions .canvas-button { min-height: 40px; padding-inline: 14px; }
.has-welcome #canvas-world, .has-welcome #canvas-wires, .has-welcome #canvas-map, .has-welcome .canvas-controls { visibility: hidden; }
.standalone-canvas kbd { font: 500 10px/1.2 Geist, system-ui, sans-serif; padding: 2px 4px; background: #eef2f8; color: #485b75; border-radius: 4px; white-space: nowrap; }
.standalone-canvas .canvas-primary kbd { background: #ffffff25; color: #fff; }
.workspace-shortcuts { width: min(480px, calc(100% - 28px)); padding: 18px; }
.workspace-shortcuts .video-zoom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workspace-shortcuts dl { margin: 12px 0 0; }
.workspace-shortcuts dl div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #e8edf4; font-size: 12px; }
.workspace-shortcuts dd { margin: 0; text-align: end; }
@media (max-width: 600px) {
  .workspace-top { min-height: 48px; padding: 6px 10px; gap: 5px; }
  .workspace-project-tools, .workspace-identity { gap: 4px; }
  .workspace-wide { display: none; }
  .standalone-canvas .canvas-commandbar { padding: 6px 8px; gap: 4px; }
  .standalone-canvas .canvas-foot { flex-direction: row; align-items: start; flex-wrap: wrap; padding-inline: 10px; }
  .welcome-art { border-radius: 10px; }
  .welcome-actions { gap: 6px; }
  .welcome-actions .canvas-button { padding-inline: 9px; min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .standalone-canvas .canvas-button, .canvas-controls button { transition: none; transform: none; }
}
