.editor{background:#fff;min-height:100dvh}.editor-header{min-height:58px;border-bottom:1px solid var(--line);display:flex;gap:1.1rem;align-items:center;padding:8px 18px;font-size:.88rem}.editor-header #project-title{font-weight:650;overflow-wrap:anywhere}.editor-header>a:last-child{margin-left:auto}.editor-header #save-state{color:var(--muted)}.toolbar{display:flex;gap:.7rem;flex-wrap:wrap;align-items:center;padding:7px 12px;border-bottom:1px solid var(--line);background:#f7faf8}.tool-group{display:flex;align-items:center;gap:4px;padding-right:.7rem;border-right:1px solid var(--line)}.toolbar button,.toolbar summary,.circuit-tabs button,.zoom-controls button{font-size:.82rem;padding:.38rem .65rem}.toolbar summary{cursor:pointer;font-weight:600;padding-inline:.45rem}.toolbar details{position:relative}.dropdown{position:absolute;top:100%;left:0;z-index:5;display:grid;min-width:174px;padding:5px;background:white;border:1px solid var(--line);border-radius:6px;box-shadow:0 6px 22px #173c3420}.dropdown button{justify-content:start;border:0}.inline{display:flex;align-items:center;gap:5px;font-size:.82rem;padding-left:5px}.inline select{padding:.25rem}.editor-grid{display:grid;grid-template-columns:208px minmax(0,1fr) 235px;flex:1;min-height:0}.palette,.properties{padding:14px;overflow:auto;max-height:calc(100dvh - 106px)}.palette{border-right:1px solid var(--line)}.properties{border-left:1px solid var(--line)}.editor h2{font-size:.96rem;margin:0 0 12px}.properties h2:not(:first-child){margin-top:18px}.palette input{width:100%;font-size:.82rem;margin-bottom:.75rem}.palette details{padding-block:6px;border-bottom:1px solid var(--line)}.palette summary,.analyzer summary{cursor:pointer;font-size:.83rem;font-weight:650}.palette-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin:.5rem 0}.palette-list button{font-size:.71rem;padding:.35rem .25rem;min-height:36px;overflow-wrap:anywhere}.palette-list .active,.toolbar button[aria-pressed=true],.circuit-tabs button[aria-current=true]{background:#dff3e8;border-color:#8fcbb0;color:#07583c}.workspace{display:flex;flex-direction:column;min-width:0}.circuit-tabs{display:flex;align-items:center;gap:.4rem;padding:6px 9px;background:white;border-bottom:1px solid var(--line);overflow-x:auto;white-space:nowrap}.circuit-tabs>div{display:flex;gap:.3rem}.surface{position:relative;min-height:430px;flex:1;background:#f8fbf9}.surface > svg{display:block;position:absolute;inset:0;width:100%;height:100%;touch-action:none;user-select:none}.surface > svg.pan{cursor:grab}.surface > svg.place,.pin{cursor:crosshair}.zoom-controls{display:flex;gap:.25rem;position:absolute;bottom:10px;right:10px}.editor-status{display:flex;gap:1rem;flex-wrap:wrap;align-items:center;min-height:32px;padding:5px 10px;border-top:1px solid var(--line);font-size:.78rem;color:var(--muted)}.editor-status .notice{margin:0}.analyzer{border-top:1px solid var(--line);padding:8px 10px}.analyzer>div{overflow:auto;max-height:230px}.timing-svg{display:block;font-family:monospace;font-size:11px}.properties label{font-size:.79rem;margin-bottom:.65rem}.properties :is(input,textarea,select){width:100%;font-size:.8rem;padding:.42rem}.properties button{font-size:.8rem;padding:.4rem .55rem;margin-bottom:.45rem}.properties p{font-size:.8rem;margin-bottom:.5rem}.properties code{display:block;font-size:.74rem;overflow-wrap:anywhere}.part{cursor:move}.part text{pointer-events:none;user-select:none}.wire-hit{cursor:pointer}.part.selected .body{stroke:#00966a;stroke-width:2.8}.pin:hover,.pin.active{fill:#22bd84;stroke:#05654d}.wire-hit:hover+.wire,.wire.selected{stroke:#0088b3}.body{fill:white;stroke:#27564a;stroke-width:1.7;stroke-linejoin:round}.node-label{font:600 11px system-ui;fill:#25453b;text-anchor:middle}.pin-label{font:9px system-ui;fill:#4b665e}.signal-label{font:700 11px monospace;text-anchor:middle;fill:#087b56}.editor .quiet{font-size:.82rem}
@media(max-width:900px){.editor-grid{grid-template-columns:165px minmax(0,1fr) 170px}.palette,.properties{padding:10px}.surface{min-height:55vh}}
@media(max-width:650px){.editor-grid{grid-template-columns:115px minmax(0,1fr)}.properties{grid-column:1/-1;border-top:1px solid var(--line);max-height:none}.surface{min-height:52vh}.palette{max-height:60vh}.palette-list{grid-template-columns:1fr}.editor-header{gap:.5rem;padding:8px;flex-wrap:wrap}.editor-header .wordmark img{width:110px}.toolbar{gap:.35rem}.tool-group{padding-right:0;border:0}}


.editor-header {
  border-top: 3px solid var(--green);
  background: #fff;
}
.editor .toolbar {
  padding-block: 9px;
  background: #edf4f0;
}
.editor .workspace { background: #fff; }
.editor .palette, .editor .properties { background: #fbfdfb; }
.editor .palette details[open] > summary { color: var(--green-dark); }
.editor .circuit-tabs { background: #f5f9f6; }
.editor .editor-status { background: #f3f7f4; }
.editor .analyzer[open] { background: #fbfdfb; }

.surface > svg { background: #fff; }
.grid-minor-line, .grid-major-line { fill: none; vector-effect: non-scaling-stroke; }
.grid-minor-line { stroke: #e1ece7; stroke-width: 1; }
.grid-major-line { stroke: #bfd5ca; stroke-width: 1.35; }

.palette-list button {
  flex-direction: column;
  justify-content: center;
  gap: .2rem;
  min-height: 60px;
  line-height: 1.15;
  text-align: center;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.palette-list button:active { cursor: grabbing; }
.component-symbol { display: block; width: 38px; height: 25px; }
.symbol-line {
  fill: none;
  stroke: #27564a;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.component-symbol .body, .component-symbol .symbol-line { vector-effect: non-scaling-stroke; }
.canvas-symbol { pointer-events: none; }

.palette-tooltip {
  position: fixed;
  z-index: 25;
  display: grid;
  gap: .2rem;
  max-width: min(248px, calc(100vw - 16px));
  padding: .6rem .75rem;
  border: 1px solid #cee0d6;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px #1c392c20;
  font-size: .82rem;
  pointer-events: none;
}
.palette-tooltip span { color: var(--muted); }
.dragging-component, .dragging-component .surface > svg { cursor: grabbing; }
.placement-preview > rect { fill: #eaf6ee; fill-opacity: .78; stroke: #087b56; stroke-width: 1.2; stroke-dasharray: 4 3; }
.placement-preview .component-symbol { width: 68px; height: 46px; }

.palette details {
  padding-block: 0;
  border-color: #dce9e2;
}
.palette details > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 35px;
  padding: .35rem .35rem;
  list-style: none;
}
.palette details > summary::-webkit-details-marker { display: none; }
.palette details > summary::after {
  content: "";
  width: .42rem;
  height: .42rem;
  margin-right: .15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.palette details[open] > summary::after { transform: translateY(2px) rotate(225deg); }

.palette-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 0 0 .45rem;
  padding: 4px;
  border: 1px solid #dce9e2;
  border-radius: 5px;
  background: #fff;
}
.palette-list button {
  min-height: 43px;
  min-width: 0;
  padding: 0;
  border-color: transparent;
}
.palette-list button:hover { border-color: #afd0bd; }
.palette-list .component-symbol { width: min(100%, 47px); height: 32px; }
.palette-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.symbol-terminal { fill: #118856; stroke: none; }
.palette-list .symbol-line { stroke: #233b32; stroke-width: 1.75; }
@media (max-width: 900px) {
  .palette-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.framebuffer-preview {
  display: block;
  width: 100%;
  height: auto;
  margin: .65rem 0;
  border: 1px solid var(--line);
  background: #101914;
  image-rendering: pixelated;
}
