:root{color-scheme:dark;--base:#080e17;--panel:#0d1622;--panel-2:#101d2c;--border:#233548;--ink:#e2edf7;--dim:#8ea5bc;--cyan:#65deff;--blue:#179bc3;--violet:#bd9cff;--amber:#ffbe74;font-family:Inter,"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",system-ui,sans-serif;font-size:14px}
*{box-sizing:border-box}
body{margin:0;color:var(--ink);background:var(--base);height:100svh;min-height:560px;display:flex;flex-direction:column;overflow:hidden}
button,input,select{font:inherit}
button{display:inline-flex;align-items:center;justify-content:center;gap:7px;white-space:nowrap;cursor:pointer;color:#cce1f2;background:#131f2e;border:1px solid #2a3c51;border-radius:6px;padding:0 11px;min-height:34px}
button:hover{border-color:#4a7d99;background:#182c3c;color:#f0faff}
button:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--cyan);outline-offset:3px}
button[disabled]{opacity:.38;cursor:default}
button svg,.search svg,#logo svg{width:16px;height:16px;flex:none}
button.primary{background:#56d7fa;color:#061723;border-color:#5adcf9;font-weight:700}
button.primary:hover{background:#9deaff;color:#061723}
.appbar{height:68px;flex:none;border-bottom:1px solid var(--border);background:#0b1420;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:0 20px}
.identity{display:flex;align-items:center;gap:12px;white-space:nowrap}
.identity strong{display:block;letter-spacing:.06em;font-size:17px}
.identity span{display:block;margin-top:3px;color:var(--dim);font-size:11px;letter-spacing:.14em}
#logo{width:37px;height:37px;display:grid;place-items:center;border:1px solid #2b7692;border-radius:8px;background:radial-gradient(at 50% 20%,#173a4a,#0e2332);color:var(--cyan);box-shadow:0 0 12px #2fbcf52c}
#logo svg{width:23px;height:23px}
.top-actions{display:flex;align-items:center;gap:7px}
#save-status{color:var(--dim);font-size:12px;margin-right:6px;white-space:nowrap}
#save-status i{display:inline-block;width:6px;height:6px;border-radius:50%;background:#52d7b5;margin-right:3px}
#undo,#redo{padding:0 8px}
.workspace{display:grid;grid-template-columns:196px minmax(0,1fr) 222px;flex:1;min-height:0}
.sidebar{min-height:0;padding:15px 13px;background:var(--panel);overflow:auto;scrollbar-color:#2b4a5f #0d1622}
.library{border-right:1px solid var(--border)}
.inspector{border-left:1px solid var(--border)}
.panel-title{display:flex;justify-content:space-between;align-items:center;gap:7px;margin-bottom:16px}
h2,h3,p{margin:0}
.panel-title h2{font-size:15px;letter-spacing:.06em}
.panel-title span{font-size:11px;color:var(--dim)}
.search{display:flex;align-items:center;gap:7px;height:35px;border-radius:5px;background:#081320;border:1px solid #2b3e54;padding:0 8px;color:#7597af}
.search input{color:#e2edf7;border:0;background:none;outline:none;min-width:0;width:100%;font-size:12px}
.search:focus-within{border-color:#64d7f3}
.filter-group{display:flex;gap:4px;margin:11px 0}
.filter-group button{border:0;background:transparent;color:var(--dim);padding:0 7px;font-size:12px;min-height:28px}
.filter-group button[aria-pressed=true]{background:#19354a;color:#a6ecff}
#catalog{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.asset{display:grid;grid-template-rows:auto 18px;justify-items:center;align-items:center;text-align:center;padding:4px 3px 5px;border:1px solid #273a4e;border-radius:6px;min-width:0;min-height:82px;background:radial-gradient(ellipse at 50% 54%,#162d42 0,#101b29 68%);color:#bcd3e4;cursor:grab;font-size:11px}
.asset:hover{color:#dcf8ff;border-color:#3b8aac;background:radial-gradient(ellipse,#1c3b52,#122231)}
.asset:active{cursor:grabbing}
.asset svg{width:100%;max-width:71px;height:53px;overflow:visible;pointer-events:none}
.asset span{pointer-events:none}
.library-help,.muted{font-size:12px;line-height:1.7;color:var(--dim)}
.library-help{margin-top:13px}
.main{min-width:0;min-height:0;display:flex;flex-direction:column}
.canvas-bar{min-height:51px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;background:#0d1724;border-bottom:1px solid var(--border)}
.canvas-title{display:flex;align-items:center;gap:8px;white-space:nowrap}
.canvas-title strong{font-size:14px;letter-spacing:.08em}
.canvas-title span{font-size:10px;padding:3px 5px;border:1px solid #314761;color:#acc4d8;border-radius:3px}
.tools{display:flex;gap:4px}
.tools button{font-size:12px;min-height:31px}
.tools button[aria-pressed=true]{border-color:#4586a4;color:#98eaff;background:#17374c}
#reset{font-size:12px;min-height:31px}
.viewport{flex:1;min-height:0;position:relative;overflow:hidden;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 52%,#10233a,#080f1c 79%);touch-action:none}
.surface{position:absolute;top:50%;left:50%;overflow:hidden;transform-origin:50% 50%;width:0;height:0;box-shadow:0 10px 32px #020710b5;border:1px solid #28445c;aspect-ratio:16/9}
#canvas{width:100%;height:100%;display:block;user-select:none;touch-action:none}
#canvas[data-tool=water],#canvas[data-tool=power]{cursor:crosshair}
#canvas .board-title{font-size:27px;fill:#c4e6f7;font-weight:700;letter-spacing:4px}
#canvas .board-sub{font-size:14px;fill:#678eab;font-weight:500;letter-spacing:3px}
#canvas .board-status{font-size:14px;fill:#74ccdd;font-weight:500;letter-spacing:1px}
#canvas .device{cursor:grab;outline:none}
#canvas .device:active{cursor:grabbing}
.device .select-outline{fill:none;stroke:#61d9fa;stroke-width:1.5;stroke-dasharray:5 5;opacity:0;pointer-events:none}
.device:hover .select-outline,.device:focus-visible .select-outline{opacity:.38}
.device.is-selected .select-outline{opacity:.95}
.device-label{font-size:17px;font-weight:620;fill:#dceaf5;letter-spacing:1px;paint-order:stroke;stroke:#071826;stroke-width:4px;stroke-linejoin:round;pointer-events:none}
.device-meter{font-size:13px;fill:#8fbed3;pointer-events:none;paint-order:stroke;stroke:#071826;stroke-width:3px}
.port{cursor:crosshair;outline:none}
.port .dot{fill:#102c42;stroke:#6ee5ff;stroke-width:2;opacity:.75}
.port.power .dot{fill:#251b41;stroke:#ba95ff}
.port:hover .dot,.port:focus-visible .dot,.port.active .dot{opacity:1;fill:#8befff;stroke:#e1fbff;r:7}
.port.power:hover .dot,.port.power:focus-visible .dot,.port.power.active .dot{fill:#bd99ff}
.port.invalid .dot{opacity:.21}
.line{outline:none;cursor:pointer}
.line .halo{stroke:#22b2ea;opacity:.17;stroke-width:19;filter:blur(3px)}
.line .shadow{stroke:#050f19;stroke-width:13}
.line .tube{stroke:#317491;stroke-width:9}
.line .core{stroke:#184259;stroke-width:5}
.line .glint{stroke:#95d3e5;stroke-width:1;opacity:.27}
.line .motion{stroke:#75e6ff;stroke-width:2.8;stroke-dasharray:9 19;filter:drop-shadow(0 0 3px #4fdcff);animation:travel var(--speed,1.1s) linear infinite;animation-direction:var(--direction,normal)}
.line.power .halo{stroke:#8f58ed}
.line.power .tube{stroke:#59478a;stroke-width:6}
.line.power .core{stroke:#32284e;stroke-width:4}
.line.power .motion{stroke:#dbbbff;stroke-width:2.2;stroke-dasharray:3 25;filter:drop-shadow(0 0 3px #c094ff)}
.line.selected .tube,.line:focus-visible .tube{stroke:#a2ebff}
.line.power.selected .tube,.line.power:focus-visible .tube{stroke:#ceb0fc}
.line.inactive .motion{visibility:hidden}
.line-hit{stroke:transparent;stroke-width:22;pointer-events:stroke}
@keyframes travel{to{stroke-dashoffset:-28}}
.route-handle{cursor:move}
.route-handle:focus-visible{stroke:#fff;stroke-width:3}
.canvas-key,.zoom{position:absolute;bottom:12px;display:flex;align-items:center;border:1px solid #2a435c;background:#0a1525ed;border-radius:5px;min-height:32px}
.canvas-key{left:11px;gap:12px;padding:0 9px;font-size:11px;color:#bfd4e4;pointer-events:none}
.canvas-key i,.line-chip i{display:inline-block;width:12px;height:2px;background:#68ddff;vertical-align:middle;margin-right:4px}
.canvas-key span+span i,.line-chip.power i{background:#bd9cff}
.zoom{right:11px;gap:1px}
.zoom button{padding:0 9px;background:none;border:0;min-height:30px;font-size:12px}
.statusbar{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:31px;padding:5px 12px;border-top:1px solid var(--border);background:#0d1724;color:#8ba6bf;font-size:11px}
.statusbar span:last-child{white-space:nowrap}
#properties{font-size:12px}
.property-block{border-bottom:1px solid #26374b;padding-bottom:14px;margin-bottom:14px}
.property-block h3{margin-bottom:10px;font-size:14px;color:#d7ebf8}
.field{display:grid;gap:6px;margin-bottom:9px;color:#a1b9cb}
.field input,.field select{width:100%;min-height:34px;border:1px solid #2b435a;background:#0a1422;border-radius:5px;color:#d8eaf5;padding:5px 7px}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.field input[type=range]{padding:0;accent-color:#61dfff}
.property-buttons{display:flex;flex-wrap:wrap;gap:6px;margin-top:9px}
.property-buttons button{font-size:12px}
.danger{color:#ff9da1}
.type-label{display:inline-flex;align-items:center;gap:4px;color:#88e8ff;border:1px solid #346284;padding:2px 6px;border-radius:3px;font-size:11px;margin-bottom:8px}
.type-label.power{color:#d9b8ff;border-color:#5d4c86}
.edge-list{display:grid;gap:6px;margin-top:8px}
.edge-list button{justify-content:flex-start;overflow:hidden;text-overflow:ellipsis;white-space:normal;text-align:left;padding:6px 7px;font-size:11px;min-height:31px}
.edge-list button span{min-width:0;overflow-wrap:anywhere}
.port-list{display:grid;gap:5px;margin:7px 0}
.port-list button{justify-content:flex-start;font-size:12px;color:#9ae9ff;padding:0 7px}
.port-list button.power{color:#ddc5ff}
body.preview-mode .library,body.preview-mode .inspector,body.preview-mode .tools,body.preview-mode #reset,body.preview-mode #undo,body.preview-mode #redo,body.preview-mode #import,body.preview-mode #export{display:none}
body.preview-mode .workspace{grid-template-columns:minmax(0,1fr)}
body.preview-mode .device,body.preview-mode .line{cursor:default;pointer-events:none}
body.preview-mode .port,body.preview-mode .select-outline{display:none}
body.preview-mode .canvas-key{opacity:.8}
#toast{position:fixed;bottom:48px;left:50%;transform:translateX(-50%);z-index:4;background:#12283b;color:#e1f4ff;border:1px solid #397492;padding:9px 14px;border-radius:5px;box-shadow:0 8px 24px #000a;max-width:90vw}
dialog{background:#111d2b;color:var(--ink);border:1px solid #3f6584;border-radius:8px;max-width:90vw}
dialog::backdrop{background:#0009}
dialog h2{font-size:17px}
dialog p{margin:12px 0 16px;color:var(--dim)}
dialog form>div{display:flex;justify-content:flex-end;gap:8px}
@media(max-width:1090px){.workspace{grid-template-columns:155px minmax(0,1fr) 185px}.sidebar{padding:12px 9px}#catalog{gap:5px}.asset{min-height:70px}.asset svg{height:43px}}
@media(max-width:760px){body{height:auto;min-height:100svh;overflow:auto}.appbar{padding:8px 10px;height:auto;min-height:56px;flex-wrap:wrap;gap:6px}.identity strong{font-size:15px}.identity span,#save-status{display:none}.top-actions{gap:4px}.top-actions button{font-size:11px;padding:0 7px;min-height:32px}.workspace{grid-template-columns:1fr 1fr;grid-template-areas:"stage stage" "library inspector";flex:none}.main{grid-area:stage}.library{grid-area:library;border-top:1px solid var(--border)}.inspector{grid-area:inspector;border-top:1px solid var(--border)}.viewport{min-height:clamp(270px,62vw,430px)}.canvas-bar{padding:5px;min-height:43px}.canvas-title span,.statusbar span:last-child{display:none}.tools button{padding:0 6px}.canvas-title strong{font-size:12px}body.preview-mode .workspace{grid-template-areas:"stage"}}
.board-metrics{fill:#98b6cd;font-family:inherit;font-size:12px}
.board-metrics .board-value{font-variant-numeric:tabular-nums;fill:#9febff;font-size:19px;font-weight:700}
.board-metrics .board-value tspan{font-size:12px;font-weight:500;fill:#aecfdb}
@media(prefers-reduced-motion:reduce){.line .motion{animation-play-state:paused}}
.filter-group{flex-wrap:wrap}
.board-metrics rect{fill-opacity:.75}
#canvas[data-theme=light] .board-title{fill:#163751}
#canvas[data-theme=light] .board-sub,#canvas[data-theme=light] .board-status{fill:#385875}
#canvas[data-theme=light] .device-label{fill:#103653;stroke:#e3f0fa}
#canvas[data-theme=light] .device-meter{fill:#31546e;stroke:#e3f0fa}
#canvas[data-theme=light] .board-metrics rect{fill:#234967}
#output-dialog,#cloud-dialog{width:min(460px,calc(100vw - 28px));padding:18px 20px}
.dialog-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:13px;gap:8px}
.dialog-head h2{font-size:17px}
.dialog-head button{min-height:29px;padding:0 8px}
.dialog-footer,.dialog-actions{display:flex;justify-content:flex-end;gap:6px;flex-wrap:wrap;margin-top:10px}
.dialog-message{min-height:22px;color:#a5c6dc;line-height:1.55;font-size:12px;margin:8px 0 0}
#cloud-error{color:#ffb184}
.check-row{display:flex;align-items:center;gap:8px;margin:8px 0 15px}
.cloud-list{display:grid;gap:7px;max-height:260px;overflow:auto;padding:2px;margin-top:12px}
.cloud-row{display:flex;gap:7px;align-items:center;justify-content:space-between;border:1px solid #2a4155;padding:6px 8px;border-radius:5px;color:#cee6f5}
.cloud-row span{min-width:0;overflow-wrap:anywhere}
.cloud-row button{font-size:12px;min-height:29px}
.cloud-row time{display:block;font-size:10px;color:#94aeca;margin-top:3px}
#save-status{max-width:160px;overflow:hidden;text-overflow:ellipsis}
body.preview-mode #cloud{display:none}
@media(max-width:920px){#save-status{display:none}}
.fx-bubble{animation:bubbling 2.8s linear infinite}
.fx-lamp{animation:lamplight 1.7s ease-in-out infinite;filter:drop-shadow(0 0 4px #86ffcd)}
.fx-outline{animation:edge-light 2.3s linear infinite;filter:drop-shadow(0 0 5px #52dff9)}
@keyframes bubbling{0%{transform:translateY(0);opacity:0}20%{opacity:.72}100%{transform:translateY(-26px);opacity:0}}
@keyframes lamplight{0%,100%{opacity:.45}55%{opacity:1}}
@keyframes edge-light{to{stroke-dashoffset:-129}}
@media(prefers-reduced-motion:reduce){.fx-bubble,.fx-lamp,.fx-outline{animation-play-state:paused}}
.stage-actions{display:flex;gap:4px}
.stage-actions button{font-size:12px;min-height:31px}
body.preview-mode .stage-actions{display:none}
@media(max-width:410px){.canvas-title{display:none}.stage-actions button{padding:0 5px}.tools button{font-size:11px}}
.ui-elements{display:grid;gap:5px;margin-top:9px}
.ui-elements button{justify-content:flex-start;overflow:hidden;text-overflow:ellipsis;display:block;text-align:left;font-size:11px;padding:0 7px}
.board-item{cursor:move;outline:none}
.board-item text,.board-item .ui-picked-outline{pointer-events:none}
.board-item .ui-picked-outline{stroke:#84e4ff;stroke-width:1.2;stroke-dasharray:5 4;opacity:0}
.board-item:hover .ui-picked-outline,.board-item:focus-visible .ui-picked-outline{opacity:.45}
.board-item.picked .ui-picked-outline{opacity:1}
body.preview-mode .board-item{pointer-events:none}
body.preview-mode .board-item .ui-picked-outline{display:none}
.ui-text{fill:#c4e6f7;font-weight:700;letter-spacing:1.8px}
.ui-sub{fill:#88a9c4;font-weight:500}
.ui-status{fill:#74ccdd;font-weight:500}
.ui-metric-bg{fill:#112c42;fill-opacity:.77;stroke:#346078}
.ui-metric-label{font-size:12px;fill:#a4bfd4}
.ui-metric-value{fill:#a7efff;font-weight:700;font-variant-numeric:tabular-nums}
.ui-metric-value tspan{font-size:.65em;fill:#c3dbea;font-weight:500}
#canvas[data-theme=light] .ui-text{fill:#1b3a56}
#canvas[data-theme=light] .ui-metric-bg{fill:#294b64;fill-opacity:.96}
@media(min-width:761px){
  body:not(.preview-mode) .workspace{grid-template-columns:var(--panel-left,196px) 14px minmax(0,1fr) 14px var(--panel-right,222px)}
}
.splitter{cursor:col-resize;touch-action:none;background:#102232;position:relative;z-index:3;min-width:0}
.splitter::after{content:"";position:absolute;width:4px;height:46px;left:50%;top:min(45%,240px);transform:translateX(-50%);background:#4a718d;border-radius:3px}
.splitter:hover,.splitter:focus-visible,.splitter.resizing{background:#315b76}
.preview-mode .splitter,#split-mobile,.layout-mobile{display:none}
@media(max-width:760px){
  body:not(.preview-mode) .workspace{grid-template-columns:var(--panel-mobile,50%) 14px minmax(0,1fr);grid-template-areas:"stage stage stage" "library split inspector"}
  #split-left,#split-right,.layout-desktop{display:none}
  body:not(.preview-mode) #split-mobile{display:block;grid-area:split}
  .layout-mobile{display:grid}
}
#layout-dialog{width:min(400px,calc(100vw - 28px))}
#layout-dialog output{color:#8cdef0}
#canvas:focus{outline:none}
#selection-overlay rect{fill:#4bd1f122;stroke:#75e3ff;stroke-dasharray:5 4;stroke-width:1.5;vector-effect:non-scaling-stroke}
#node-position{margin-bottom:9px}
#node-position button{min-height:28px}
#channel-controls{display:flex;align-items:center;gap:8px;padding:5px 10px;border-bottom:1px solid var(--border);background:#101c2a;color:#9bbed2;font-size:12px}
#channel-controls[hidden],.guest-mode #channel-controls{display:none}
#channel-controls label{display:flex;align-items:center;gap:5px;white-space:nowrap}
#quick-mode{max-width:115px;border:1px solid #355069;border-radius:4px;padding:3px;background:#102535;color:#d0e7f4}
#quick-switches{display:flex;gap:4px;min-width:0;overflow:auto}
#quick-switches button{min-height:25px;flex:none;font-size:11px;padding:0 7px}
#quick-switches button[aria-pressed=true]{color:#aaf4ff;border-color:#3e849d;background:#163b4c}
.canvas-bar{flex-wrap:wrap}
#catalog{grid-template-columns:repeat(auto-fit,minmax(min(100%,var(--tile-width,76px)),1fr))}
.asset{min-height:calc(var(--tile-width,76px)*.92 + 10px)}
.asset svg{max-width:var(--tile-width,76px);height:calc(var(--tile-width,76px)*.63)}
.library-scale{display:block;font-size:12px;color:#9cb7ce;margin:9px 0}
.library-scale output{float:right}
.library-scale input{display:block;width:100%;accent-color:#5bd3ef}
.line.inactive .tube,.line.inactive .core{stroke:var(--off-color,#566274)}
.line.inactive .core{opacity:.4}
.line.inactive .halo,.line.inactive .direction,.line.inactive .glint{visibility:hidden}
.line.inactive.selected .tube{stroke:var(--off-color,#566274)}
.fx-outline{animation:contour-flow var(--glow-duration,2s) linear infinite;filter:drop-shadow(0 0 4px var(--glow-color,#61e6ff))}
@keyframes contour-flow{to{stroke-dashoffset:var(--glow-period,-106)}}
.strategy-status{color:#7de4ed;font-size:11px;align-self:center;max-width:125px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.strategy-columns{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.strategy-columns section,.strategy-card{min-width:0;border:1px solid #294257;border-radius:6px;padding:9px}
.strategy-card{margin:7px 0;background:#102534}
.strategy-head,.strategy-toolbar,.strategy-row{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.strategy-head{justify-content:space-between;margin-bottom:8px}.strategy-toolbar{padding:7px 0;gap:9px;color:#99cbdc}
.strategy-head h3{font-size:14px;margin:0}
.strategy-row{margin:4px 0;font-size:11px;color:#a8c1d5}
.strategy-row input,.strategy-row select{background:#0a1421;border:1px solid #31506c;border-radius:4px;color:#d8eafa;min-width:0;padding:4px}
.strategy-row .strategy-name,.strategy-row select{flex:1;min-width:68px}
.strategy-row .schedule-seconds{width:56px}
.strategy-row button,.strategy-head button{min-height:28px;font-size:11px;padding:0 6px}
.strategy-row input[type=color],.strategy-toolbar input[type=color]{width:31px;height:24px;padding:1px;vertical-align:middle}
.strategy-channels{display:flex;gap:6px;flex-wrap:wrap;color:#c7dae8;font-size:12px}
.strategy-channels label{display:flex;align-items:center;gap:2px}
@media(max-width:1050px){.strategy-status{display:none}}
@media(max-width:760px){.strategy-columns{grid-template-columns:1fr}.canvas-title{display:none}}
.catalog-drag-ghost{position:fixed;top:0;left:0;width:86px;height:66px;z-index:80;pointer-events:none;border:1px solid #386780;border-radius:8px;background:#10283bd9;box-shadow:0 3px 20px #0008}
.catalog-drag-ghost svg{width:100%;height:100%}
body.guest-mode #cloud{display:inline-flex;background:#175371;border-color:#3b8baa;color:#d9f7ff}
body.guest-mode #preview{display:none}

#quick-play{flex:none;min-height:28px;background:#174355;border-color:#3b778a;color:#b5f3ff}
#quick-play[aria-pressed=true]{background:#41305c;border-color:#8665a4;color:#efddff}
#quick-play:disabled{opacity:.45}
#channel-controls .strategy-status{display:block;flex:0 1 145px;min-width:0}
@media(max-width:640px){#channel-controls .strategy-status{display:none}}
#strategy-dock{flex:0 0 auto;min-width:0}
#strategy-dialog{display:flex;flex-direction:column;container-type:inline-size;width:100%;max-height:38vh;min-width:0;overflow:hidden;background:#0f1b28;border:1px solid #37556c}
#strategy-dialog[hidden],#strategy-dock[hidden],#channel-context[hidden],#group-name-field[hidden]{display:none}
#strategy-dialog.strategy-floating{position:fixed;z-index:20;width:min(860px,calc(100vw - 16px));max-height:min(68vh,720px);border-radius:9px;box-shadow:0 12px 40px #0009}
.strategy-titlebar{flex:none;margin:0;padding:7px 10px;background:#142838;border-bottom:1px solid #35536a}
.strategy-titlebar div{display:flex;gap:5px}
.strategy-titlebar h2{font-size:14px}
.strategy-floating .strategy-titlebar{cursor:move;touch-action:none;user-select:none}
.strategy-body{padding:8px;overflow:auto;min-height:0;scrollbar-color:#365a70 #101a27}
@container(max-width:640px){.strategy-columns{grid-template-columns:1fr}}
@container(min-width:641px){.strategy-columns{grid-template-columns:repeat(3,minmax(0,1fr))}}
.strategy-card.channel-focused{border-color:#5ebcd4}
.strategy-card [data-strategy-action=inspect-channel][aria-expanded=true],.strategy-members-list button[aria-pressed=true]{background:#16445a;border-color:#62bfd4;color:#b3f0fc}
#channel-members{margin-top:8px;border-top:1px solid #315064;padding-top:7px}
.strategy-members-head{display:flex;justify-content:space-between;align-items:center;gap:5px;font-size:12px}
.strategy-members-head button{min-height:25px;font-size:11px;padding:0 6px}
.strategy-members-list{display:grid;gap:4px;margin-top:5px;max-height:160px;overflow:auto}
.strategy-members-list button{display:block;min-height:27px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap;font-size:11px;padding:0 6px}
#channel-context{position:fixed;z-index:30;padding:5px;background:#142838;border:1px solid #47738a;border-radius:6px;box-shadow:0 8px 22px #0009}
#channel-group-dialog{width:min(410px,calc(100vw - 28px))}
.line.selected .glint,.line.inactive.selected .glint{visibility:visible;stroke:#d6fbff;stroke-width:1.7;stroke-dasharray:5 5;opacity:.85}

#channel-list{max-height:155px;overflow:auto;scrollbar-color:#365a70 #101a27}

body.preview-mode #new-scene{display:none}
#new-scene-dialog{width:min(420px,calc(100vw - 28px))}
#new-scene-error[hidden]{display:none}
.channel-operation{display:flex;align-items:center;justify-content:space-between;gap:5px;flex-wrap:wrap;font-size:11px;margin-top:4px}
.channel-command{max-width:100%;background:#102433;color:#d7edf6;border:1px solid #385e74;border-radius:4px;padding:4px}
.channel-state{color:#8d9dac}
.channel-state[data-running=true]{color:#80e9c3}
#channel-list{max-height:205px}
.device[data-channel]:not([data-channel=""])[data-effective-state=standby] .device-art{filter:saturate(.35);opacity:.65}
.device[data-effective-state=standby] .fx-bubble,.device[data-effective-state=standby] .fx-lamp,.device[data-effective-state=standby] .fx-outline{visibility:hidden}

.catalog-label{margin:10px 0 5px;font-size:11px;color:#8daec5;font-weight:650}
#catalog-systems{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,67px),1fr));gap:4px}
#catalog-systems button{min-width:0;min-height:28px;border-color:#293e55;padding:3px;font-size:11px;line-height:1.2}
#catalog-systems button[aria-pressed=true]{background:#1a435a;border-color:#4796ac;color:#c0f4ff}
#filters{flex-wrap:wrap;margin:5px 0;gap:1px}
#filters button{font-size:10px;min-height:21px;padding:0 4px}
.asset{grid-template-rows:auto minmax(18px,auto);font-size:11px;line-height:1.22}
.asset span{max-width:100%;overflow-wrap:anywhere}
.tools{flex-wrap:wrap}
#media-tool{border:1px solid #314a60;background:#102433;color:#d7edf6;border-radius:5px;min-width:0;font-size:11px;padding:3px 4px}
#canvas[data-tool=air],#canvas[data-tool=chemical],#canvas[data-tool=sludge]{cursor:crosshair}
.canvas-key{flex-wrap:wrap;gap:3px 9px;max-width:calc(100% - 108px);padding-block:4px}
.canvas-key [hidden]{display:none}
.canvas-key span:not(.power) i{background:#68ddff}
.port.air .dot{stroke:#73f4db}.port.chemical .dot{stroke:#ffc56e}.port.sludge .dot{stroke:#e5a47e}
.line.air .tube{stroke:#27796f}.line.air .motion{stroke:#73f4db;filter:drop-shadow(0 0 3px #45d6bc)}
.line.chemical .tube{stroke:#92623a}.line.chemical .motion{stroke:#ffc56e;filter:drop-shadow(0 0 3px #fcb656)}
.line.sludge .tube{stroke:#825743}.line.sludge .motion{stroke:#e5a47e;filter:drop-shadow(0 0 3px #dc986a)}
.canvas-key span.air i,.line-chip.air i{background:#73f4db}
.canvas-key span.chemical i,.line-chip.chemical i{background:#ffc56e}
.canvas-key span.sludge i,.line-chip.sludge i{background:#e5a47e}
.port-list .air,.type-label.air{color:#73f4db}
.port-list .chemical,.type-label.chemical{color:#ffc56e}
.port-list .sludge,.type-label.sludge{color:#e5a47e}
.line.inactive.air .tube,.line.inactive.chemical .tube,.line.inactive.sludge .tube{stroke:var(--off-color,#566274)}
#canvas .plant-impeller{animation:plant-turn 1.64s linear infinite}
#canvas .device[data-effective-state=standby] .plant-impeller{animation:none}
@keyframes plant-turn{to{transform:rotate(360deg)}}
#scene-preset{border:1px solid #3b637e;background:#122c3f;color:#cff0ff;border-radius:5px;min-height:32px;max-width:150px;font-size:12px;padding:0 7px}

@media(prefers-reduced-motion:reduce){#canvas .plant-impeller{animation-play-state:paused}}

.pool-cells{max-height:16rem;overflow:auto;padding:0 5px 0 0;margin-bottom:10px;scrollbar-gutter:stable}

.sequence-sr{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#sequence-notice-fallback{padding:7px 12px;color:#ffcd83;background:#222022;border-bottom:1px solid #725032;font-size:12px}
#sequence-notice-fallback[hidden]{display:none}
#sequence-audio-open{flex:none}
#sequence-audio-dialog{width:min(420px,calc(100vw - 28px))}
.sequence-audio-body{padding:0 18px 14px}
#music-status{overflow-wrap:anywhere}
.child-device-list{display:grid;gap:6px;margin-top:8px}
.child-device-list button{text-align:left}
.child-device-list button small{display:block;color:#94b0c1}

.line.custom-color:not(.inactive) .halo,.line.custom-color:not(.inactive) .glint,.line.custom-color:not(.inactive) .motion{stroke:var(--line-color)}
.line.custom-color:not(.inactive) .tube{stroke:color-mix(in srgb,var(--line-color) 62%,#132937)}
.line.custom-color:not(.inactive) .core{stroke:color-mix(in srgb,var(--line-color) 30%,#0c1d2c)}
.line.custom-color:not(.inactive) .motion{filter:drop-shadow(0 0 3px var(--line-color))}
.line.custom-color.selected:not(.inactive) .glint,.line.custom-color:focus-visible:not(.inactive) .glint{stroke:#fff;visibility:visible;stroke-dasharray:5 5;opacity:.85}

.line-waypoint-list{display:flex;gap:5px;flex-wrap:wrap;margin-top:7px}

.catalog-import{padding:0 10px 6px}
.catalog-import button{width:100%}
#custom-dialog{width:min(480px,calc(100vw - 26px));max-height:90vh}
.custom-body{padding:0 18px 14px}
.custom-body hr{border:0;border-top:1px solid var(--border);margin:15px 0}
#custom-image-preview{display:block;max-width:150px;max-height:90px;margin:4px auto 10px}
#custom-image-preview[hidden],.custom-ports[hidden]{display:none}
.custom-ports{display:grid;grid-template-columns:1fr 1fr;gap:0 8px}

.fluid-folder{margin:8px 0;border:1px solid #2c4459;border-radius:6px;background:#102132}
.fluid-folder summary{padding:7px 8px;cursor:pointer;color:#c4e7f7;font-size:12px}
.fluid-folder summary small,#fluid-categories small,.fluid-id{font-variant-numeric:tabular-nums;color:#8ab9d4}
.fluid-folder summary small{float:right}
#fluid-categories{display:grid;gap:2px;padding:0 4px 4px}
#fluid-categories button{display:flex;align-items:center;justify-content:space-between;gap:6px;text-align:left;padding:3px 7px;min-height:26px;border-color:transparent;background:transparent;font-size:11px}
#fluid-categories button:hover,#fluid-categories button[aria-pressed=true]{background:#194258;color:#d5f6ff}
.fluid-id{font-size:9px;pointer-events:none}
#catalog-pager{display:flex;align-items:center;justify-content:space-between;gap:4px;margin:8px 0;color:#a9cedf;font-size:11px}
#catalog-pager[hidden]{display:none}
#catalog-pager button{min-height:26px;padding:2px 5px;font-size:11px}
.port-heading,.port-editor-list>div{display:flex;justify-content:space-between;align-items:center;gap:6px}
.port-heading{margin-bottom:8px}
.port-heading h3{margin:0}
.port-editor-list{display:grid;gap:4px}
.port-editor-list button{min-height:27px;padding:3px 6px;font-size:11px}
.port-editor-list [data-use-port]{flex:1;text-align:left}
#port-edit-dialog{width:min(410px,calc(100vw - 28px));padding:18px 20px}
#port-edit-error{color:#ffb184}
.port .dot{stroke:var(--medium-color,#9cecff)}
.canvas-key .extended-medium i{background:var(--medium-color)}
.line.extended-medium:not(.inactive):not(.custom-color) .tube{stroke:color-mix(in srgb,var(--medium-color) 58%,#102b3a)}
.line.extended-medium:not(.inactive):not(.custom-color) .motion{stroke:var(--medium-color);filter:drop-shadow(0 0 3px var(--medium-color))}
.line.extended-medium.solid .motion{stroke-dasharray:3 11}
