body.sc-editor {
  background: var(--sc-bg);
  color: var(--sc-text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- top bar ----------------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--sc-panel);
  border-bottom: 1px solid var(--sc-line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.brand { letter-spacing: .02em; }
.room { color: var(--sc-dim); font-family: ui-monospace, monospace; }
.spacer { flex: 1; }

.add { display: flex; gap: 6px; }

button {
  font: inherit;
  color: var(--sc-text);
  background: var(--sc-panel-2);
  border: 1px solid var(--sc-line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover { border-color: #3a424d; background: #252b33; }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; }
button.danger { color: var(--sc-bad); border-color: #4a2a2a; }

.status {
  font: 600 12px/1 ui-monospace, monospace;
  color: var(--sc-warn);
  padding: 5px 8px;
  border-radius: 999px;
  background: #241f12;
  white-space: nowrap;
}
.status.ok { color: var(--sc-ok); background: #12241a; }
.status.bad { color: var(--sc-bad); background: #241414; }

.who { display: flex; gap: 6px; }
.who span {
  font-size: 12px;
  background: var(--sc-panel-2);
  border: 1px solid var(--sc-line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--sc-dim);
}
.who span.busy { color: var(--sc-accent); border-color: #2a3a57; }

/* --- work area --------------------------------------------------------- */

.work {
  flex: 1;
  display: flex;
  min-height: 0;
}

.canvasWrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
}

/* The pasteboard: the full working surface, most of which is off-stage. It is
   deliberately flat and dim so the live canvas inside it reads as the only
   thing that matters. */
.pasteboard {
  position: relative;
  background: #0b0d10;
  border: 1px solid #1a1e24;
  border-radius: 4px;
  overflow: hidden;
}

/* The canvas: exactly what OBS composites. The checkerboard reads as
   "transparent" the way every image editor does, and the border is the line
   between "on stream" and "not". */
.canvasArea {
  position: absolute;
  background-color: #15181c;
  background-image:
    linear-gradient(45deg, #1b1f24 25%, transparent 25%, transparent 75%, #1b1f24 75%),
    linear-gradient(45deg, #1b1f24 25%, transparent 25%, transparent 75%, #1b1f24 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  outline: 1px solid #3b4654;
  box-shadow: 0 0 0 1px rgba(91, 156, 255, .25), 0 18px 50px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.offstageLabel {
  position: absolute;
  top: 6px;
  left: 8px;
  font: 600 10px/1 ui-monospace, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #39414c;
  pointer-events: none;
  user-select: none;
}

.pasteboard #stage { position: absolute; }

/* The renderer clips to the canvas, which is right for the overlay and wrong
   here -- the whole point of the pasteboard is seeing what sits outside it. */
.sc-editor .sc-root { overflow: visible; }

.handles, .guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hint {
  margin: 0;
  color: #6c7684;
  font-size: 12px;
}
.hint kbd {
  font: inherit;
  background: var(--sc-panel-2);
  border: 1px solid var(--sc-line);
  border-radius: 4px;
  padding: 0 4px;
}

/* --- selection handles ------------------------------------------------- */

.sel {
  position: absolute;
  border: 1.5px solid var(--sc-accent);
  pointer-events: none;
  transform-origin: 50% 50%;
}
.sel.peer { border-color: #ffb020; border-style: dashed; }

.grip {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -6px 0 0 -6px;
  background: #fff;
  border: 1.5px solid var(--sc-accent);
  border-radius: 2px;
  pointer-events: auto;
}
.grip[data-dir="rot"] {
  border-radius: 50%;
  background: var(--sc-accent);
  border-color: #fff;
  cursor: grab;
}
.grip[data-dir="nw"], .grip[data-dir="se"] { cursor: nwse-resize; }
.grip[data-dir="ne"], .grip[data-dir="sw"] { cursor: nesw-resize; }
.grip[data-dir="n"],  .grip[data-dir="s"]  { cursor: ns-resize; }
.grip[data-dir="e"],  .grip[data-dir="w"]  { cursor: ew-resize; }

.guides line { stroke: #ff3ba7; stroke-width: 1; shape-rendering: crispEdges; }

/* --- side panels ------------------------------------------------------- */

.side {
  flex: 0 0 310px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--sc-line);
  background: var(--sc-panel);
  min-height: 0;
  /* A flex item defaults to min-width:auto, so wide rows inside would widen
     the panel past its 310px basis and push the labels off screen. */
  min-width: 0;
  overflow: hidden;
}

.panel {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sc-line);
  min-height: 0;
  /* Size to content; without this the layers list gets squeezed by .grow. */
  flex: 0 0 auto;
}
.panel.grow { flex: 1 1 auto; overflow-y: auto; }

.panel h2 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--sc-dim);
  display: flex;
  justify-content: space-between;
}
.count { color: #5d6672; }

.layers {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 34vh;
  overflow-y: auto;
}
.layers li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.layers li:hover { background: var(--sc-panel-2); }
.layers li[aria-selected="true"] { background: #1d2b45; }
.layers .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layers .ty { font-size: 11px; color: #5d6672; font-family: ui-monospace, monospace; }
.layers .ty.staged { color: var(--sc-warn); }
.layers button {
  padding: 1px 5px;
  font-size: 12px;
  background: transparent;
  border-color: transparent;
  line-height: 1.3;
}
.layers button:hover { border-color: var(--sc-line); }
.layers li.off .nm { opacity: .45; text-decoration: line-through; }

/* --- property rows ----------------------------------------------------- */

.props { display: flex; flex-direction: column; gap: 9px; }
.props .empty { color: #5d6672; margin: 0; }

.row { display: flex; align-items: center; gap: 8px; }
.row > label {
  flex: 0 0 74px;
  color: var(--sc-dim);
  font-size: 12px;
}
.row input[type="text"],
.row input[type="number"],
.row textarea,
.row select {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--sc-text);
  background: var(--sc-bg);
  border: 1px solid var(--sc-line);
  border-radius: 6px;
  padding: 5px 7px;
}
.row textarea { resize: vertical; min-height: 58px; font-family: inherit; }
.row input[type="color"] {
  flex: 0 0 38px;
  height: 28px;
  padding: 0;
  background: none;
  border: 1px solid var(--sc-line);
  border-radius: 6px;
}
.row input[type="range"] { flex: 1; }
.row.pair { gap: 6px; }
.row.pair input { flex: 1 1 0; min-width: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* --- toast ------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #22272e;
  border: 1px solid var(--sc-line);
  border-radius: 8px;
  padding: 9px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  z-index: 50;
  max-width: 70vw;
}
.toast.bad { border-color: #553; color: var(--sc-warn); }

/* In the editor, an interactive embed must not swallow the pointer or you
   can't select or drag it. Only the overlay lets embeds take clicks. */
.sc-editor .sc-embed { pointer-events: none !important; }
