*{box-sizing:border-box}body{margin:0;font:14px/1.4 Inter,system-ui,sans-serif;background:#080F20;color:#F6F9FF;height:100vh;display:flex;flex-direction:column}
header{display:flex;flex-wrap:wrap;gap:10px;align-items:center;padding:10px 14px;background:#111C32;border-bottom:1px solid #22304f}
header strong{margin-right:8px}
input{background:#080F20;color:#F6F9FF;border:1px solid #2A3A60;border-radius:6px;padding:5px 7px;width:80px}
input[type=text]{width:100%}input[type=color]{padding:0;width:44px;height:30px}
button,.btn{background:#176BFF;color:#fff;border:0;border-radius:6px;padding:7px 12px;cursor:pointer;font:inherit}
button:hover,.btn:hover{filter:brightness(1.15)}.danger{background:#7a2440}
main{flex:1;display:flex;min-height:0}
#stage{flex:1;overflow:auto;padding:24px;display:block;cursor:grab}#stage.panning{cursor:grabbing}#svg{display:block;margin:0 auto}
#svg{background:#fff;box-shadow:0 0 0 1px #2A3A60,0 10px 40px #0008;touch-action:none}
aside{width:260px;background:#111C32;border-left:1px solid #22304f;padding:14px;overflow:auto}
aside h2{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:#04D8F1;margin:8px 0}
aside label{display:block;margin:8px 0;color:#b9c4e0}aside label input{display:block;width:100%;margin-top:3px}
.row{display:flex;gap:6px;margin:8px 0}.row button{flex:1}#del{width:100%}
#list{list-style:none;padding:0;margin:0}#list li{padding:6px 8px;border-radius:6px;cursor:pointer;display:flex;justify-content:space-between}
#list li:hover{background:#1b2a4a}#list li.sel{background:#176BFF}
.shape{cursor:move}.shape text{pointer-events:none;font-family:Inter,system-ui,sans-serif}
.handle{cursor:nwse-resize;fill:#176BFF}
@media print{@page{margin:10mm}header,aside{display:none}body,#stage{background:#fff;padding:0;display:block;overflow:visible;height:auto}#svg{box-shadow:none}.handle{display:none}}
@media (max-width:700px){main{flex-direction:column}aside{width:auto;border-left:0;border-top:1px solid #22304f}}
#palette{width:180px;background:#111C32;border-right:1px solid #22304f;padding:10px;display:flex;flex-direction:column;gap:8px;overflow:auto}
.pi{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 4px;border:1px solid #2A3A60;border-radius:8px;cursor:grab;user-select:none;touch-action:none;font-size:12px;color:#b9c4e0}
.pi:hover{border-color:#04D8F1;color:#fff}.pi svg{width:30px;height:30px;stroke:#04D8F1;stroke-width:2;fill:none}.pi svg text{fill:#04D8F1;stroke:none}
.ghost{position:fixed;pointer-events:none;z-index:9;opacity:.85;transform:translate(-50%,-50%)}
@media print{#palette{display:none}}
@media (max-width:700px){#palette{width:auto;flex-direction:row;border-right:0;border-bottom:1px solid #22304f}}
.zoom{display:inline-flex;align-items:center;gap:4px}.zoom button{padding:7px 11px}#zl{min-width:46px;text-align:center;color:#b9c4e0}
.chk{display:inline-flex;align-items:center;gap:6px;cursor:pointer}.chk input{width:auto;accent-color:#176BFF}
#share{background:#B84CEB}#live{color:#04D8F1;font-size:12px;min-width:60px}
#palette{display:grid;grid-template-columns:1fr 1fr;align-content:start}#palette h3,#lib{grid-column:1/-1}
#palette h3{margin:8px 0 0;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#04D8F1}
#lib{display:grid;grid-template-columns:1fr 1fr;gap:8px}.pi span{text-align:center;line-height:1.15}
#lib .pi svg{stroke:none;fill:none}
@media (max-width:700px){#palette{display:flex}}
.rhandle{cursor:grab}@media print{.rhandle{display:none}}
#libq{grid-column:1/-1;width:100%}#lib h4{grid-column:1/-1;margin:6px 0 0;font-size:11px;color:#8fa3c8;font-weight:600}.pi[hidden],#lib h4[hidden]{display:none}

#pname{width:220px;background:transparent;border:1px solid transparent;font-weight:700;font-size:16px;padding:5px 8px}#pname:hover{border-color:#2A3A60}#pname:focus{border-color:#176BFF;outline:0;background:#080F20}
#palette{overflow-x:hidden;overflow-y:auto;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}#lib{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.pi{min-width:0}.pi span{overflow-wrap:anywhere}
*{scrollbar-width:thin;scrollbar-color:#2A3A60 transparent}
::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track,::-webkit-scrollbar-corner{background:transparent}::-webkit-scrollbar-thumb{background:#2A3A60;border-radius:8px;border:2px solid #111C32}::-webkit-scrollbar-thumb:hover{background:#176BFF}::-webkit-scrollbar-button{display:none;width:0;height:0}

#fs{font-size:15px;line-height:1}#fsbar{display:none}
body.full header,body.full #palette,body.full #panel{display:none}body.full main{position:relative}
body.full #fsbar{display:flex;gap:6px;position:absolute;top:14px;right:14px;z-index:5;padding:6px;background:#111C32e6;border:1px solid #2A3A60;border-radius:10px;backdrop-filter:blur(6px)}
body.full #fsbar button{padding:7px 11px}body.full #fsx{background:#2A3A60}
@media print{#fsbar{display:none!important}}

.layers button{background:#1b2a4a;font-size:16px;padding:6px 0}.layers button:hover{background:#176BFF}
#list li{cursor:grab;border-top:2px solid transparent;border-bottom:2px solid transparent}#list li.dragging{opacity:.4}#list li.dropa{border-top-color:#04D8F1}#list li.dropb{border-bottom-color:#04D8F1}
