/* PUDRUS Lab · Nodos — Blender-style node editor */
:root {
  --bg: #0a0a10; --panel: #15151d; --panel2: #1d1d27; --line: #2b2b38;
  --text: #d8dbe6; --dim: #8a8ea3; --accent: #66ff33;
  --t-float: #a1a1a1; --t-vec2: #6363c7; --t-color: #c7c729;
  --c-in: #b33b3b; --c-gen: #3b6ab3; --c-uv: #6a3bb3; --c-col: #b3973b; --c-fx: #3b9a8a; --c-code: #c0457a; --c-hydra: #d0603a; --c-out: #4a4a55;
  --font: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  /* what a theme changes besides the colours above */
  --accent-rgb: 102,255,51; --bg-rgb: 10,10,16; --panel-rgb: 21,21,29; --hi-rgb: 255,255,255;
  --head: #fff; --sel: #fff; --node: rgba(32, 32, 42, 0.96); --node-bd: #000;
  --ctl: #2b2b38; --ctl-bd: #111; --fill: #3d5a9c; --field: #11111a; --field-bd: #333;
  --hover-bd: #555; --hover-bd2: #666; --meter-bg: #333; --scroll: #3a3a48;
  --code-bg: #0d0d14; --code-bg2: #0b0b11; --code-text: #e6e6f0; --err-text: #ffb3c0;
  --ctl-col: #ff3fa4; --warn: #ffd166; --red: #ff2a4d; --red-soft: #ff6680; --ok-soft: #7bd88f; --bad-soft: #ff7a7a; --bad-note: #ff8099;
  --faint: #666; --lic-free: #7fdc6a; --lic-nc: #d9b24a; --lic-unk: #888;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 12px; overflow: hidden; }
button, select, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Top bar ── */
.lab-bar {
  position: fixed; inset: 0 0 auto 0; height: 44px; z-index: 50;
  display: flex; align-items: center; gap: 6px; padding: 0 10px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.lab-bar::-webkit-scrollbar { display: none; }
.lab-logo { font-weight: 700; letter-spacing: 2px; color: var(--accent); white-space: nowrap; margin-right: 6px; text-decoration: none; }
.lab-logo span { color: var(--dim); font-weight: 400; }
.lab-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.lab-btn {
  flex: none; height: 30px; padding: 0 10px; border-radius: 6px;
  background: var(--panel2); border: 1px solid var(--line); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.lab-btn:hover { border-color: var(--hover-bd); }
.lab-btn.is-on { border-color: var(--accent); color: var(--accent); }
.lab-btn.is-rec { background: #ff2a4d; border-color: #ff2a4d; color: #fff; }
.lab-btn select { background: transparent; border: 0; }
.lab-meter { display: inline-flex; gap: 2px; align-items: flex-end; height: 18px; margin-left: 2px; }
.lab-meter i { width: 4px; height: 100%; background: var(--meter-bg); position: relative; overflow: hidden; border-radius: 1px; }
.lab-meter i::after { content: ''; position: absolute; inset: auto 0 0 0; height: calc(var(--v, 0) * 100%); background: var(--accent); }
.lab-pop {
  position: fixed; top: 48px; z-index: 60; min-width: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.lab-pop[hidden] { display: none; }
.lab-pop button.item { display: block; width: 100%; text-align: left; padding: 7px 8px; border-radius: 5px; background: none; border: 0; }
.lab-pop button.item:hover { background: var(--panel2); color: var(--accent); }
.lab-pop label { display: block; color: var(--dim); margin: 6px 2px 4px; }
.lab-pop select, .lab-pop input[type=range] { width: 100%; }
.lab-pop select { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 5px; }

/* ── Workspace ── */
.lab-work {
  position: fixed; inset: var(--bar-h, 44px) 0 0 0; overflow: hidden; touch-action: none;
  background-color: var(--bg);
  background-image: linear-gradient(rgba(var(--hi-rgb),0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--hi-rgb),0.035) 1px, transparent 1px);
}
.lab-work.is-panning { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#links { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
#links path { fill: none; stroke-width: 2.4; stroke-linecap: round; }
#links path.t-float { stroke: var(--t-float); }
#links path.t-vec2 { stroke: var(--t-vec2); }
#links path.t-color { stroke: var(--t-color); }
#links path.temp { stroke: var(--sel); stroke-dasharray: 6 5; }

/* Backdrop mode: what is on air fills the workspace behind the nodes
   (the EN VIVO monitor, or the preview when working in Directo) */
.lab-work.backdrop.is-direct .lab-preview,
.lab-work.backdrop:not(.is-direct) .lab-live { inset: 0; width: auto !important; height: auto !important; border: 0; border-radius: 0; z-index: 0; }
.lab-work.backdrop .lab-preview-bar { top: auto; bottom: 10px; right: 10px; z-index: 6; }
.lab-work.backdrop #world { z-index: 1; }
.lab-work.backdrop:not(.is-direct) .lab-live .lab-tag { display: none; }
.lab-live .lab-preview-bar { z-index: 3; }
.lab-live:fullscreen { border: 0; border-radius: 0; cursor: none; }
.lab-live:fullscreen .lab-preview-bar, .lab-live:fullscreen .lab-tag { display: none; }

/* ── Nodes ── */
.nd {
  position: absolute; width: 210px; border-radius: 7px;
  background: var(--node); border: 1px solid var(--node-bd);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45); user-select: none;
}
.nd.is-sel { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel), 0 6px 18px rgba(0,0,0,0.45); }
.nd.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(0,0,0,0.45); }
.nd-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  height: 26px; padding: 0 8px; border-radius: 6px 6px 0 0;
  background: var(--cat, #444); color: #fff; font-weight: 600; cursor: grab;
}
.nd-head:active { cursor: grabbing; }
.nd-x { background: none; border: 0; color: rgba(255,255,255,0.6); font-size: 15px; line-height: 1; padding: 2px 4px; }
.nd-x:hover { color: #fff; }
.nd-body { padding: 6px 0 8px; }
.nd-row { position: relative; display: flex; align-items: center; min-height: 24px; padding: 2px 12px; }
.nd-row.out { justify-content: flex-end; }
.nd-row .lbl { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-row select { width: 100%; background: var(--ctl); border: 1px solid var(--ctl-bd); border-radius: 4px; padding: 3px 4px; }
.sock {
  position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  border: 1.5px solid var(--node-bd); cursor: crosshair; z-index: 2;
}
.sock::after { content: ''; position: absolute; inset: -8px; }   /* bigger hit area */
.nd-row.in .sock { left: -6px; }
.nd-row.out .sock { right: -6px; }
.sock.t-float { background: var(--t-float); }
.sock.t-vec2 { background: var(--t-vec2); }
.sock.t-color { background: var(--t-color); }
.sock:hover { transform: scale(1.25); }

/* Blender-like number field: drag left/right, click to type */
.num {
  position: relative; flex: 1; height: 20px; border-radius: 4px; overflow: hidden;
  background: var(--ctl); border: 1px solid var(--ctl-bd); cursor: ew-resize;
  display: flex; align-items: center; justify-content: space-between; padding: 0 7px;
}
.num-fill { position: absolute; inset: 0 auto 0 0; background: var(--fill); pointer-events: none; }
.num span { position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num .num-v { color: var(--head); margin-left: 6px; font-variant-numeric: tabular-nums; }
.num input { position: absolute; inset: 0; z-index: 2; width: 100%; border: 0; background: var(--field); color: var(--head); padding: 0 7px; text-align: center; }
.colorw { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.colorw input { width: 46px; height: 20px; border: 1px solid var(--ctl-bd); border-radius: 4px; background: none; padding: 0; cursor: pointer; }

/* ── Preview ── */
.lab-preview {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  background: #000; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.lab-preview canvas { display: block; width: 100%; height: 100%; }
.lab-preview-bar { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.lab-preview-bar button { width: 26px; height: 22px; border-radius: 4px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.15); font-size: 11px; }
.lab-preview-bar button.is-on { border-color: var(--accent); color: var(--accent); }
.lab-preview:fullscreen { border: 0; border-radius: 0; cursor: none; }
.lab-preview:fullscreen .lab-preview-bar { display: none; }

/* ── Add menu (Shift+A) ── */
.lab-add { width: 250px; max-height: 70vh; overflow: auto; }
.lab-add input { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; margin-bottom: 6px; }
.lab-add h4 { color: var(--dim); font-weight: 400; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin: 8px 4px 2px; }
.lab-add .item i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; background: var(--cat); }

.lab-toast {
  position: fixed; left: 50%; bottom: 18px; z-index: 80; transform: translateX(-50%);
  max-width: min(640px, 90vw); padding: 10px 14px; border-radius: 8px;
  background: rgba(var(--bg-rgb),0.95); border: 1px solid var(--line); white-space: pre-wrap;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.lab-toast.is-on { opacity: 1; }
.lab-toast.is-err { border-color: #ff2a4d; color: var(--err-text); }

.lab-help { width: 640px; max-width: calc(100vw - 16px); max-height: calc(100vh - 64px); overflow: auto; line-height: 1.6; padding: 0 12px 12px; }
.hp-tabs { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 0 8px; margin-bottom: 6px; background: var(--panel); border-bottom: 1px solid var(--line); }
.hp-tabs button { height: 26px; padding: 0 9px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel2); color: var(--dim); }
.hp-tabs button:hover { color: var(--text); }
.hp-tabs button.is-on { border-color: var(--accent); color: var(--accent); }
.lab-help section[hidden] { display: none; }
.hp-steps { padding-left: 20px; color: var(--dim); }
.hp-steps li { margin: 6px 0; }
.hp-steps b, .hp-dl b, .hp-tip b { color: var(--text); font-weight: 600; }
.hp-flow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; color: var(--dim); }
.hp-flow span { padding: 1px 7px; border-radius: 4px; color: #fff; }
.hp-flow .c-uv, .hp-dl dt.c-uv { background: var(--c-uv); }
.hp-flow .c-gen, .hp-dl dt.c-gen { background: var(--c-gen); }
.hp-flow .c-col, .hp-dl dt.c-col { background: var(--c-col); }
.hp-flow .c-fx, .hp-dl dt.c-fx { background: var(--c-fx); }
.hp-flow .c-out, .hp-dl dt.c-out { background: var(--c-out); }
.hp-dl dt.c-in { background: var(--c-in); }
.hp-socks { display: flex; gap: 6px; align-items: center; margin-top: 4px; color: var(--dim); }
.hp-socks .sock { position: static; display: inline-block; margin: 0 0 0 6px; }
.hp-dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; align-items: start; margin: 4px 0; }
.hp-dl dt { justify-self: start; padding: 1px 7px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line); color: var(--head); font-weight: 600; white-space: nowrap; }
.hp-dl dd { color: var(--dim); }
.hp-tip { color: var(--dim); margin: 8px 0; }
.hp-pre { margin: 6px 0; padding: 6px 8px; border-radius: 5px; background: var(--code-bg); border: 1px solid var(--line); color: var(--text); font: 11px/1.5 var(--font); overflow-x: auto; white-space: pre; }
.hp-keys { columns: 2; column-gap: 24px; }
.hp-keys h5 { color: var(--accent); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin: 8px 0 4px; break-after: avoid; }
.hp-keys p { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid rgba(var(--hi-rgb),0.04); color: var(--text); break-inside: avoid; }
.hp-keys p span { color: var(--dim); text-align: right; }
@media (max-width: 640px) { .hp-dl { grid-template-columns: 1fr; } .hp-keys { columns: 1; } }
.lab-help kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line); text-align: center; color: var(--head); }
.lab-help p { color: var(--dim); }
.lab-mobile-note { display: none; }
@media (max-width: 700px) {
  .lab-mobile-note { display: block; position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 70; padding: 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); }
}

/* ── Preview / on air ── */
.lab-go.is-pending { border-color: #ff2a4d; color: #fff; background: #4a1220; animation: lab-pulse 1.2s ease-in-out infinite; }
@keyframes lab-pulse { 50% { background: #7a1830; } }
#fadeSel { padding: 0 6px; }
#fadeSel option { background: var(--panel); }
.lab-tag { position: absolute; left: 6px; top: 6px; z-index: 2; padding: 2px 6px; border-radius: 4px; font-size: 10px; letter-spacing: 1px; background: rgba(0,0,0,0.6); color: var(--dim); pointer-events: none; }
.lab-live {
  position: absolute; right: 12px; top: 294px; z-index: 5; width: 320px; height: 180px;
  background: #000; border: 2px solid #ff2a4d; border-radius: 8px; overflow: hidden;
}
.lab-live .lab-tag { color: #ff6680; }
.lab-live canvas { display: block; width: 100%; height: 100%; }
.lab-live.is-flash { animation: lab-flash .5s ease-out; }
@keyframes lab-flash { from { box-shadow: 0 0 0 6px rgba(255,42,77,0.7); } to { box-shadow: 0 0 0 0 rgba(255,42,77,0); } }
.lab-work.is-direct .lab-live { display: none; }
.lab-work.is-direct .lab-preview { border: 2px solid #ff2a4d; }
.lab-work.is-direct .lab-preview .lab-tag { color: #ff6680; }
.lab-work.is-direct .lab-preview .lab-tag::after { content: ' · DIRECTO'; }
.lab-work.backdrop.is-direct .lab-preview .lab-tag { display: none; }
.lab-preview:fullscreen .lab-tag { display: none; }

/* ── Scenes ── */
.lab-scenes { position: absolute; left: 12px; bottom: 12px; z-index: 5; display: flex; gap: 6px; }
.scene {
  position: relative; width: 88px; height: 50px; border-radius: 6px; cursor: pointer;
  background: #000 center / cover no-repeat; border: 1px solid var(--line);
}
.scene.is-empty { background: rgba(var(--panel-rgb),0.85); border-style: dashed; }
.scene:hover { border-color: var(--hover-bd2); }
.scene.is-live { border: 2px solid #ff2a4d; }
.scene-n { position: absolute; left: 4px; top: 3px; padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,0.65); font-size: 10px; color: #fff; }
.scene-go { position: absolute; right: 3px; bottom: 3px; width: 22px; height: 18px; border-radius: 4px; border: 0; background: rgba(0,0,0,0.7); color: #fff; font-size: 10px; opacity: 0; }
.scene:hover .scene-go, .scene.is-live .scene-go { opacity: 1; }
.scene-go:hover { background: #ff2a4d; }

/* ── Node thumbnails ── */
.nd-thumb { display: block; width: calc(100% - 12px); aspect-ratio: 16 / 9; height: auto; margin: 4px 6px 6px; border-radius: 4px; background: #000; }
@media (max-width: 700px) { .lab-live, .lab-scenes { display: none; } }

/* ── Live controls / phone remote ── */
.num.is-ctl { box-shadow: inset 3px 0 0 var(--ctl-col); }
.lab-remote { width: 560px; max-width: calc(100vw - 16px); }
.lab-remote p { margin: 2px 0 6px; line-height: 1.5; }
.lab-remote .dim, .lab-pop .dim { color: var(--dim); }
.lab-remote a { color: var(--accent); word-break: break-all; font-size: 11px; }
.rm-top { display: flex; gap: 12px; align-items: flex-start; }
.rm-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.rm-tabs .lab-mini.is-on { border-color: var(--accent); color: var(--accent); }
.rm-scr { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line, #2a2a33); }
.rm-scr .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-scr .dim { flex: none; font-size: 11px; min-width: 110px; text-align: right; }
#ctlList[hidden], .ctl-head[hidden] { display: none; }
.rm-qr { flex: none; width: 150px; height: 150px; background: #fff; border-radius: 6px; padding: 4px; color: #000; font-size: 11px; }
.rm-qr svg { display: block; width: 100%; height: 100%; }
.rm-status { color: var(--warn); }
.lab-mini { height: 22px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); }
.ctl-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; border-bottom: 1px solid var(--line); }
.ctl-row b { width: 18px; color: var(--ctl-col); }
.ctl-row span { flex: 1; }
.ctl-row button { background: none; border: 0; color: var(--dim); font-size: 16px; }
.ctl-row button:hover { color: var(--red); }
#bpm { font-weight: 600; color: var(--accent); min-width: 24px; }
.pv-veil { position: absolute; inset: 0; z-index: 1; display: none; pointer-events: none; }

/* ── Text / Image nodes ── */
.nd-text { width: 100%; margin: 0; resize: vertical; min-height: 34px; background: var(--field); color: var(--head); border: 1px solid var(--field-bd); border-radius: 4px; padding: 4px 6px; font: inherit; }
.nd-file { width: 100%; margin: 0; height: 24px; border-radius: 4px; border: 1px dashed var(--hover-bd); background: var(--field); text-align: left; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-file:hover { border-color: var(--accent); color: var(--accent); }
.ctl-row.is-off span { color: var(--dim); }
.ctl-row { gap: 6px; }
.ctl-name { flex: 1; min-width: 0; height: 24px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); }
.ctl-kind { height: 24px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); color: var(--dim); padding: 0 4px; }
span.ctl-kind { display: inline-flex; align-items: center; color: var(--ctl-col); }
.ctl-num { width: 64px; height: 24px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); }
.ctl-row button.lab-mini { color: var(--text); font-size: 11px; }
.ctl-row .ctl-x { background: none; border: 0; color: var(--dim); font-size: 16px; }
.scene-page { width: 42px; height: 50px; border-radius: 6px; border: 1px solid var(--line); background: rgba(var(--panel-rgb),0.9); color: var(--dim); font-size: 10px; }
.scene-page:hover { color: var(--accent); border-color: var(--accent); }

/* ── Overlay layer panel ── */
.lab-overlay { width: 520px; max-width: calc(100vw - 16px); max-height: calc(100vh - 70px); overflow: auto; }
.ov-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ov-show { flex: 1; display: flex !important; align-items: center; gap: 6px; margin: 0 !important; color: var(--text) !important; }
.ov-item { border: 1px solid var(--line); border-radius: 6px; padding: 6px; margin-bottom: 6px; }
.ov-item.is-off { opacity: 0.5; }
.ov-head { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.ov-head .ov-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-text { flex: 1; min-width: 0; height: 24px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); }
.ov-head input[type=color] { width: 30px; height: 24px; border: 1px solid var(--ctl-bd); border-radius: 4px; background: none; padding: 0; }
.ov-head select, .ov-sl select { height: 24px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.ov-sl { display: flex !important; align-items: center; gap: 6px; margin: 0 !important; }
.ov-sl span { width: 72px; flex: none; color: var(--dim); font-size: 11px; }
.ov-sl input[type=range], .ov-sl select { flex: 1; min-width: 0; }
.pv-ov { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; display: none; pointer-events: none; }
.ov-head select { width: auto; flex: none; }
.ov-text { min-width: 140px; }
.lab-overlay input[type=range] { accent-color: var(--accent); }
.ov-head .ctl-x { background: none; border: 0; color: var(--dim); font-size: 16px; cursor: pointer; }
.lab-help { overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.hp-dl dt { white-space: normal; max-width: 100%; line-height: 1.4; }
.hp-socks .sock { flex: none; }
.hp-keys p { display: block; }
.hp-keys p span { float: right; margin-left: 8px; }
.hp-keys p::after { content: ''; display: block; clear: both; }

/* help: the sample sockets must not catch clicks (their ::after widens the hit area) */
.hp-socks .sock { position: relative; top: auto; margin-top: 0; cursor: default; pointer-events: none; }
.hp-socks .sock::after { display: none; }

/* ── Top bar fits the screen ── */
.lab-btn .t { white-space: nowrap; }
.lab-helpbtn { position: sticky; right: 0; z-index: 2; box-shadow: -10px 0 10px var(--panel); }
#patchPop .dim, #examples .dim { color: var(--dim); float: right; margin-left: 16px; }
@media (max-width: 1800px) {
  .lab-btn .t:not(.t1) { display: none; } /* icons only; the name stays in the tooltip */
  .lab-btn { padding: 0 9px; }
}
@media (max-width: 1650px) { .lab-logo span { display: none; } }
@media (max-width: 1340px) { .lab-btn .t1 { display: none; } }   /* Negro / Strobe / Capa / Control last */
@media (max-width: 1500px) {
  .lab-bar { gap: 4px; padding: 0 8px; }
  .lab-sep { margin: 0 2px; }
  .lab-full { display: none; }            /* ⛶ is also on the EN VIVO monitor and the F key */
}
@media (max-width: 1250px) {
  #btnThumbs { display: none; }           /* P key */
  .lab-btn { padding: 0 7px; }
}

/* ── Movable / resizable preview and on-air windows ── */
.win-grip { position: absolute; left: 0; right: 0; top: 0; height: 28px; z-index: 2; cursor: move; }
.lab-preview .lab-tag, .lab-live .lab-tag { z-index: 3; pointer-events: none; }
.lab-preview .lab-preview-bar, .lab-live .lab-preview-bar { z-index: 4; }
.win-size { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; z-index: 4; cursor: nwse-resize;
            background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.35) 60%, transparent 60%, transparent 70%, rgba(255,255,255,0.35) 70%, rgba(255,255,255,0.35) 80%, transparent 80%); opacity: 0; transition: opacity .15s; }
.lab-preview:hover .win-size, .lab-live:hover .win-size, .is-moving .win-size { opacity: 1; }
.lab-preview:hover .win-grip, .lab-live:hover .win-grip { background: linear-gradient(rgba(255,255,255,0.08), transparent); }
.is-moving { box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.lab-work.backdrop.is-direct .lab-preview .win-grip, .lab-work.backdrop.is-direct .lab-preview .win-size,
.lab-work.backdrop:not(.is-direct) .lab-live .win-grip, .lab-work.backdrop:not(.is-direct) .lab-live .win-size,
.lab-preview:fullscreen .win-grip, .lab-preview:fullscreen .win-size, .lab-live:fullscreen .win-grip, .lab-live:fullscreen .win-size { display: none; }
.ctl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ctl-head label { margin: 0 !important; }

.hp-dl dt.c-code { background: var(--c-code); }
.hp-dl dt.c-hydra { background: var(--c-hydra); }
/* ── Mixer strip (decks A/B + crossfader) ── */
.lab-mixer { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 5px;
             padding: 4px 6px; border-radius: 7px; background: rgba(0,0,0,0.62); border: 1px solid rgba(255,255,255,0.12); opacity: 0.35; transition: opacity .15s; }
.lab-live:hover .lab-mixer, .lab-preview:hover .lab-mixer, .lab-mixer:focus-within { opacity: 1; }
.lab-mixer button { width: 24px; height: 22px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.2); background: #15151d; font-weight: 700; font-size: 11px; }
.lab-mixer button.is-on { border-color: #ff2a4d; color: #ff6680; }
.lab-mixer input[type=range] { width: 120px; accent-color: #ff2a4d; }
.lab-mixer select { height: 22px; background: #15151d; border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; font-size: 10px; }
.lab-work.backdrop .lab-mixer { bottom: 44px; }
.lab-live:fullscreen .lab-mixer, .lab-preview:fullscreen .lab-mixer { display: none; }
#btnGo .deck-l { color: var(--red-soft); }
/* ── Code editor ── */
.lab-code { position: fixed; left: 50%; top: calc(var(--bar-h, 44px) + 12px); transform: translateX(-50%); z-index: 65; width: min(860px, calc(100vw - 24px)); height: min(640px, calc(100vh - 80px));
            display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,0.6); }
.lab-code[hidden] { display: none; }
.code-head { display: flex; align-items: center; gap: 8px; }
.code-head b { color: var(--c-code); filter: brightness(1.4); }
.code-head .sp { flex: 1; }
.code-head select { height: 24px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; }
#codeArea, #hydraArea { flex: 1; resize: none; background: var(--code-bg2); color: var(--code-text); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font: 12.5px/1.55 var(--font); tab-size: 2; white-space: pre; overflow: auto; }
.code-err { min-height: 18px; max-height: 110px; overflow: auto; margin: 0; color: var(--accent); font: 11.5px/1.45 var(--font); white-space: pre-wrap; }
.code-err.is-err { color: var(--err-text); }
.code-help { color: var(--dim); font-size: 11px; line-height: 1.5; }
.code-help b { color: var(--text); font-weight: 600; }
.nd-code { border-style: solid !important; border-color: var(--c-code) !important; }
#codeArea, #hydraArea { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }

/* ── Export panel ── */
.lab-export { width: 480px; max-width: calc(100vw - 16px); max-height: calc(100vh - 64px); overflow: auto; }
.lab-export h4 { margin: 10px 2px 6px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.lab-export h4:first-child { margin-top: 2px; }
.lab-export .dim { color: var(--dim); font-size: 11px; line-height: 1.5; margin: 0 2px 6px; text-transform: none; letter-spacing: 0; }
.exp-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.exp-row button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; }
.exp-row button small { font-weight: 400; color: var(--dim); font-size: 10px; }
.exp-row button.is-on, .exp-seg button.is-on { border-color: var(--accent); color: var(--accent); }
.ar { display: block; border: 2px solid currentColor; border-radius: 2px; opacity: 0.8; }
.ar-169 { width: 32px; height: 18px; } .ar-916 { width: 14px; height: 25px; } .ar-45 { width: 20px; height: 25px; } .ar-11 { width: 22px; height: 22px; }
.exp-grid { display: grid; grid-template-columns: 80px 1fr; gap: 6px 10px; align-items: center; margin-top: 10px; }
.exp-grid > span { color: var(--dim); }
.exp-seg { display: flex; gap: 4px; flex-wrap: wrap; }
.exp-seg button { height: 26px; padding: 0 10px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel2); }
.exp-size { margin: 8px 2px; color: var(--text); font-variant-numeric: tabular-nums; }
.exp-chk { display: flex !important; align-items: center; gap: 6px; margin: 6px 2px !important; color: var(--text) !important; }
.exp-row2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.exp-row2 label { display: flex !important; align-items: center; gap: 6px; margin: 0 !important; color: var(--text) !important; }
#expDur { width: 56px; height: 24px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); padding: 0 4px; }
.exp-durs button { padding: 0 8px; }
.exp-reel { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; }
.exp-reelname { flex: 1 1 200px; min-width: 0; color: var(--dim); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.exp-reelname.has { color: var(--text); }
.exp-reel input[type=number] { width: 64px; height: 24px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); padding: 0 4px; }
#cutSrcSeg.is-off { opacity: 0.4; pointer-events: none; }
#reelInfo:empty, #reelOpts[hidden], #reelDrop[hidden] { display: none !important; }
.exp-go { border-color: var(--accent) !important; color: var(--accent); }
#expRec.is-rec { background: #ff2a4d; border-color: #ff2a4d; color: #fff; }
#expCancel { display: none; }
.exp-prog { display: none; position: relative; width: 100%; height: 22px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--line); overflow: hidden; }
.exp-prog i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, rgba(var(--accent-rgb),0.25), rgba(var(--accent-rgb),0.55)); }
.exp-prog span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; }
#expRenderBox.is-busy .exp-prog, #expRenderBox.is-busy #expCancel { display: flex; }
#expRenderBox.is-busy .exp-go { opacity: 0.4; pointer-events: none; }
/* ── Safe-zone guides on the monitors (not recorded) ── */
.safe-guide { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: none; }
.safe-guide.on { display: block; }
.safe-guide.on::before, .safe-guide.on::after { content: ''; position: absolute; left: 0; right: 0; background: rgba(255,42,77,0.16); border: 1px dashed rgba(255,102,128,0.7); }
.safe-guide.fmt-9x16::before { top: 0; height: 13%; border-top: 0; }
.safe-guide.fmt-9x16::after { bottom: 0; height: 22%; border-bottom: 0; right: 0; }
.safe-guide.fmt-9x16 { background: linear-gradient(rgba(255,42,77,0.16), rgba(255,42,77,0.16)) right 0 top 40% / 15% 38% no-repeat; }
.safe-guide.fmt-4x5::before, .safe-guide.fmt-1x1::before, .safe-guide.fmt-16x9::before { inset: 5%; background: none; }
.safe-guide.fmt-4x5::after, .safe-guide.fmt-1x1::after, .safe-guide.fmt-16x9::after { display: none; }
.lab-mobile-note a { color: var(--accent); }

/* ── Desktop app panel ── */
.lab-desk { width: 440px; max-width: calc(100vw - 16px); max-height: calc(100vh - 64px); overflow: auto; }
.lab-desk h4 { margin: 10px 2px 6px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.lab-desk h4:first-child { margin-top: 2px; }
.lab-desk h4 .dim { text-transform: none; letter-spacing: 0; color: var(--dim); font-weight: 400; }
.lab-desk .dim { color: var(--dim); font-size: 11px; margin: 4px 2px; }
.dk-grid { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; align-items: center; margin: 4px 0; }
.dk-grid > span { color: var(--dim); }
.dk-grid input, .dk-grid select { width: 100%; height: 26px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel2); padding: 0 6px; }
.dk-spouts { display: grid; gap: 6px; margin: 4px 0; }
.dk-sp { display: grid; grid-template-columns: 22px 1fr 1fr 96px; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); }
.dk-sp.is-on { border-color: var(--accent); }
.dk-sp input[type=text], .dk-sp select { width: 100%; height: 26px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); padding: 0 6px; min-width: 0; }
.dk-sp .st { grid-column: 2 / -1; font-size: 11px; color: var(--dim); }
.dk-sp .st.ok { color: var(--ok-soft); } .dk-sp .st.bad { color: var(--bad-soft); }
.dk-pair { display: grid; grid-template-columns: 1fr 80px; gap: 6px; }
.dk-osc { margin: 6px 2px; color: var(--dim); font-size: 11px; line-height: 1.6; }
.dk-osc summary { cursor: pointer; color: var(--text); }
.dk-osc b { color: var(--text); }

/* top bar auto-fit (set by fitBar in editor.js) */
.lab-bar.fit-1 .lab-btn .t { display: none; }
.lab-bar.fit-2 .lab-logo span, .lab-bar.fit-2 .lab-full { display: none; }
.lab-bar.fit-3 #btnThumbs { display: none; }
.lab-bar.fit-3 .lab-btn { padding: 0 7px; }
.lab-bar.fit-4 { gap: 3px; padding: 0 6px; }
.lab-bar.fit-4 .lab-sep { display: none; }
.lab-bar.fit-4 .lab-btn { padding: 0 6px; }
.lab-bar.fit-4 .lab-meter { display: none; }

/* names on the buttons (default): always ONE row; fitBar tightens it step by step (lf-1…lf-6)
   and only drops the names of the most obvious icons when there is really no room */
.lab-bar.labels .lab-btn .t, .lab-bar.labels .lab-btn .t1 { display: inline; }
.lab-bar.labels.lf-1 .lab-logo span, .lab-bar.labels.lf-1 .lab-full { display: none; }
.lab-bar.labels.lf-2 { gap: 4px; padding: 0 8px; }
.lab-bar.labels.lf-2 .lab-btn { padding: 0 7px; gap: 4px; }
.lab-bar.labels.lf-2 .lab-sep { margin: 0 1px; }
.lab-bar.labels.lf-2 .lab-logo { letter-spacing: 1px; margin-right: 2px; }
.lab-bar.labels.lf-3 { gap: 3px; padding: 0 6px; }
.lab-bar.labels.lf-3 .lab-btn { padding: 0 5px; font-size: 11px; }
.lab-bar.labels.lf-3 #btnThumbs, .lab-bar.labels.lf-3 .lab-meter, .lab-bar.labels.lf-3 .lab-sep { display: none; }
.lab-bar.labels .lab-btn.nl .t { display: none; }   /* names dropped one by one (fitBar) */
.lab-bar.labels.lf-6 .lab-btn .t { display: none; }
.lab-btn[hidden] { display: none; }
.lab-bar.labels.lf-6 .lab-logo { font-size: 0; margin-right: 0; }
.lab-bar.labels.lf-6 .lab-logo::before { content: 'N'; font-size: 12px; }

/* ── 📚 Library ── */
.lab-libpop { position: fixed; inset: calc(var(--bar-h, 44px) + 10px) 14px 14px; z-index: 64; display: flex; flex-direction: column; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,0.65); overflow: hidden; }
.lab-libpop[hidden] { display: none; }
.lib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lib-head b { color: var(--c-code); filter: brightness(1.4); }
.lib-head input#libSearch { flex: 0 1 300px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); padding: 0 10px; }
.lib-head label { display: flex; align-items: center; gap: 5px; color: var(--dim); }
.lib-head .sp { flex: 1; }
.lib-pri { border-color: var(--accent) !important; color: var(--accent); }
.lib-manual { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.lib-manual[hidden] { display: none; }
.lib-manual textarea { flex: 1; height: 130px; resize: vertical; background: var(--code-bg2); color: var(--code-text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: 12px/1.5 var(--font); }
.lib-fields { width: 300px; display: flex; flex-direction: column; gap: 5px; }
.lib-fields input { height: 26px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel2); padding: 0 8px; }
.lib-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr; }
.lib-side { border-right: 1px solid var(--line); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.lib-side-h { display: flex; justify-content: space-between; align-items: center; color: var(--dim); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.lib-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.lib-tag { padding: 3px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); font-size: 11px; }
.lib-tag small { color: var(--dim); }
.lib-tag.on { border-color: var(--c-code); color: var(--head); background: color-mix(in srgb, var(--c-code) 40%, var(--panel2)); }
.lib-bm { border-top: 1px solid var(--line); padding-top: 10px; }
.lib-bm p { margin: 4px 0; line-height: 1.5; }
.lib-bm .dim { color: var(--dim); font-size: 11px; }
.lib-bmbtn { display: inline-block; margin: 6px 0; padding: 7px 12px; border-radius: 6px; background: var(--c-code); color: #fff; text-decoration: none; font-weight: 700; cursor: grab; }
.lib-io { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-grid { overflow: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-content: start; }
.lib-empty { grid-column: 1 / -1; color: var(--dim); padding: 30px; text-align: center; line-height: 1.6; }
.lib-card { border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); overflow: hidden; display: flex; flex-direction: column; }
.lib-card.lv-error { opacity: 0.7; }
.lib-th { position: relative; aspect-ratio: 16 / 9; background: #000 center / cover; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #555; font-size: 11px; }
.lib-th:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.lib-badge { position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; background: rgba(0,0,0,0.7); }
.lv-ok .lib-badge { color: var(--accent); } .lv-warn .lib-badge { color: #ffd166; } .lv-error .lib-badge { color: #ff2a4d; }
.lib-star { position: absolute; right: 6px; top: 4px; border: 0; background: none; font-size: 18px; color: #ddd; text-shadow: 0 1px 3px #000; }
.lib-star.on { color: #ffd166; }
.lib-info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.lib-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-info .dim { color: var(--dim); font-size: 11px; }
.lib-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.lib-chip { padding: 1px 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font-size: 10px; color: var(--dim); }
.lib-chip.mine { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.lib-note { color: var(--warn); font-size: 10.5px; line-height: 1.4; }
.lv-error .lib-note { color: var(--bad-note); }
.lib-acts { display: flex; gap: 5px; margin-top: 2px; }
.lib-acts a.lab-mini { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
.lib-use { border-color: var(--accent) !important; color: var(--accent); }
.lib-lic { color: var(--faint); font-size: 10px; }
.lib-col { border-top: 1px solid var(--line); padding-top: 10px; }
.lib-col p { margin: 4px 0; line-height: 1.5; }
.lib-col .dim { color: var(--dim); font-size: 11px; }
.lib-lic.lic-free { color: var(--lic-free); } .lib-lic.lic-nc { color: var(--lic-nc); } .lib-lic.lic-unknown { color: var(--lic-unk); }
.lib-grid { grid-auto-rows: max-content; } .lib-card { min-height: max-content; }
.fx-hint { color: var(--dim); font-size: 11px; margin: 0 2px 8px; }
.ov-head .ctl-x:disabled { opacity: 0.25; }
.tr-pop { width: 300px; max-height: 70vh; overflow: auto; }
.tr-pop .item { display: flex !important; align-items: center; gap: 8px; }
.tr-pop .item.is-cur { color: var(--accent); }
.tr-th { flex: none; width: 48px; height: 27px; border-radius: 3px; background: #000 center / cover; border: 1px solid var(--line); }
.tr-pop #transGet { margin-top: 6px; width: 100%; }

/* ── Status bar ── */
.lab-status { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: 22px; padding: 0 10px; align-items: center; gap: 12px;
  background: var(--panel); border-top: 1px solid var(--line); color: var(--dim); font: 11px/22px ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; overflow: hidden; }
body.has-status .lab-status { display: flex; }
body.has-status .lab-work { bottom: 22px; }
body.has-status .lab-toast { bottom: 34px; }
.st-i { color: var(--text); flex: none; }
.st-i.dim, .st-i .dim { color: var(--dim); }
.st-i b { font-weight: 600; }
.st-i .ok, .st-i.ok { color: #3ddc84; }
.st-i .warn, .st-i.warn { color: #ffc23d; }
.st-i .bad, .st-i.bad { color: #ff4d6a; }
.st-sep { flex: 1 1 0; min-width: 6px; }
.st-clock { margin-left: 4px; color: var(--text); }
.st-beat { display: inline-block; opacity: .35; transition: opacity .05s; }
.st-beat.on { opacity: 1; color: #3ddc84; }
.st-lv { display: inline-block; width: 34px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #3ddc84 0 calc(var(--v) * 100%), rgba(255,255,255,.12) 0); vertical-align: 1px; }
@media (max-width: 1280px) { .lab-status .st-i.lo { display: none; } }
@media (max-width: 700px) { .lab-status { display: none !important; } body.has-status .lab-work { bottom: 0; } }

/* SYNDRUS drop effects (audio panel) */
.df-box { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; margin: 2px 0 4px; border: 1px solid var(--line); border-radius: 6px; background: rgba(var(--hi-rgb),0.02); }
.df-box select { width: 100%; }
.df-l { font-size: 11px; color: var(--dim); }
.df-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.df-checks label { font-size: 11.5px; white-space: nowrap; }

/* sound source (🎤 menu) */
.src-seg { display: flex; gap: 4px; margin-bottom: 4px; }
.src-seg button { flex: 1; height: 30px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2, #16161f); color: var(--dim); cursor: pointer; font: inherit; font-size: 11.5px; white-space: nowrap; }
.src-seg button:hover { color: var(--text); }
.src-seg button.is-on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px rgba(var(--accent-rgb),0.25); }
.src-state { max-width: 340px; margin: 2px 0 6px; font-size: 11.5px; color: var(--dim); line-height: 1.4; }
.src-state.ok { color: var(--accent); }
.src-state.wait { color: var(--warn); }
#micBox[hidden], #syBox[hidden] { display: none; }
#audioPop { width: min(380px, calc(100vw - 16px)); }

/* ── LIGHT THEME (opt-in: js/theme.js sets data-theme="light" on <html>; the dark one above is the default) ──
   The same panel as the site: warm off-white, cream controls, slate strips for the top bar and the status bar, orange
   for what is active. What shows the output (the preview and live windows, the scenes) and the lights panel stay dark. */
:root[data-theme="light"] {
  --bg: #e8e6de; --panel: #f3f1ea; --panel2: #ebe2c8; --line: #c4bfb2;
  --text: #2b2f35; --dim: #5a6169; --accent: #b23c08; --c-code: #a83468;
  --t-float: #6f6f6f; --t-vec2: #5252c0; --t-color: #8a8a10;
  --accent-rgb: 178,60,8; --bg-rgb: 232,230,222; --panel-rgb: 243,241,234; --hi-rgb: 43,47,53;
  --head: #1b1e22; --sel: #1b1e22; --node: rgba(250,249,245,0.97); --node-bd: #8f897b;
  --ctl: #e9e1c9; --ctl-bd: #b5b0a3; --fill: #a9c0ea; --field: #fbfaf6; --field-bd: #b5b0a3;
  --hover-bd: #8f897b; --hover-bd2: #6d7781; --meter-bg: #c9c4b6; --scroll: #b5b0a3;
  --code-bg: #fbfaf6; --code-bg2: #fbfaf6; --code-text: #23272c; --err-text: #c21f3a;
  --ctl-col: #a8246a; --warn: #865600; --red: #c21f3a; --red-soft: #c21f3a; --ok-soft: #1f7a3d; --bad-soft: #c21f3a; --bad-note: #c21f3a;
  --faint: #6b7178; --lic-free: #1f7a3d; --lic-nc: #865600; --lic-unk: #6b7178;
}
/* the top bar and the status bar are the dark slate strips */
:root[data-theme="light"] .lab-bar, :root[data-theme="light"] .lab-status {
  color: var(--text);
  --panel: #3c444d; --panel2: #2f363d; --line: rgba(255,255,255,0.18); --panel-rgb: 60,68,77;
  --text: #eceef0; --dim: #c2c8cf; --accent: #ffa066; --accent-rgb: 255,160,102;
  --head: #fff; --hover-bd: #8a949e; --meter-bg: #23282e; --red-soft: #ff8fa0; --hi-rgb: 255,255,255;
}
/* what shows the output keeps the dark colours: its labels and buttons sit on top of the picture */
:root[data-theme="light"] .lab-preview, :root[data-theme="light"] .lab-live, :root[data-theme="light"] .scene {
  color: var(--text);
  --panel: #15151d; --panel2: #1d1d27; --line: #2b2b38; --panel-rgb: 21,21,29;
  --text: #d8dbe6; --dim: #8a8ea3; --accent: #66ff33; --accent-rgb: 102,255,51; --head: #fff; --hi-rgb: 255,255,255;
}
/* the status bar's red, brighter on slate */
:root[data-theme="light"] .lab-status .bad, :root[data-theme="light"] .lab-status .st-i.bad { color: #ff8fa0; }
:root[data-theme="light"] .nd { box-shadow: 0 3px 10px rgba(43,47,53,0.22); }
:root[data-theme="light"] .nd.is-sel { box-shadow: 0 0 0 1px var(--sel), 0 3px 10px rgba(43,47,53,0.22); }
:root[data-theme="light"] .nd.is-active { box-shadow: 0 0 0 1px var(--accent), 0 3px 10px rgba(43,47,53,0.22); }

/* the particle chooser: a grid of moving thumbnails */
.part-pop { max-height: 72vh; overflow: auto; width: 440px; max-width: calc(100vw - 16px); }
.part-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 6px; }
.part-card { display: flex; flex-direction: column; gap: 3px; padding: 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); text-align: left; min-width: 0; }
.part-card canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 4px; background: #000; }
.part-card span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-card:hover { border-color: var(--accent); color: var(--accent); }
.part-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.nd-kick { text-align: center; }

/* «Editar acá»: the particle system of a node, in a side panel (no second window in a show) */
.part-ed { position: fixed; left: 12px; top: 56px; bottom: 12px; width: 340px; z-index: 70; overflow: auto; padding: 0 0 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 34px rgba(0,0,0,0.5); scrollbar-width: thin; }
.part-ed[hidden] { display: none; }
.pe-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pe-name { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; font-weight: 700; color: var(--head); }
.pe-name:hover, .pe-name:focus { border-color: var(--line); background: var(--panel2); outline: none; }
.pe-x, .pe-kick { height: 28px; min-width: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); font-size: 14px; }
.pe-x:hover, .pe-kick:hover { border-color: var(--accent); color: var(--accent); }
.pe-tip { padding: 8px 12px 2px; color: var(--dim); font-size: 11px; line-height: 1.4; }
.pe-sec { margin: 8px 8px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); overflow: hidden; }
.pe-sh { display: flex; align-items: center; gap: 6px; padding: 6px 8px; color: #fff; background: #4a4a55; }
.pe-emit .pe-sh, .pe-sec.pe-emit .pe-sh { background: #b33b3b; }
.pe-sec.pe-force .pe-sh { background: #3b6ab3; }
.pe-sec.pe-look .pe-sh { background: #b3973b; }
.pe-sh b { flex: 1; }
.pe-sh select.pe-emit { flex: 1; height: 24px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.3); background: rgba(0,0,0,0.25); color: #fff; font-weight: 700; }
.pe-sh select.pe-emit option { color: var(--text); background: var(--panel); }
.pe-rm { height: 22px; width: 24px; border: 0; border-radius: 5px; background: rgba(0,0,0,0.25); color: #fff; font-size: 14px; line-height: 1; }
.pe-rm:hover { background: rgba(0,0,0,0.5); }
.pe-row { display: flex; align-items: center; gap: 6px; padding: 3px 8px; min-height: 26px; }
.pe-l { flex: 0 0 104px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.pe-range { flex: 1; min-width: 0; accent-color: var(--accent); }
.pe-v { flex: 0 0 42px; text-align: right; color: var(--head); font-variant-numeric: tabular-nums; font-size: 11px; }
.pe-pub { flex: none; width: 22px; height: 20px; padding: 0; border-radius: 4px; border: 1px solid var(--line); background: transparent; color: var(--dim); font-size: 11px; }
.pe-pub:hover { border-color: var(--ctl-col); color: var(--ctl-col); }
.pe-pub.is-on { border-color: var(--ctl-col); background: var(--ctl-col); color: #fff; }
.pe-sel { flex: 1; min-width: 0; height: 24px; border-radius: 5px; border: 1px solid var(--ctl-bd); background: var(--ctl); }
.pe-text { flex: 1; min-width: 0; resize: vertical; background: var(--field); color: var(--head); border: 1px solid var(--field-bd); border-radius: 5px; padding: 4px 6px; }
.pe-col { width: 46px; height: 22px; border: 1px solid var(--ctl-bd); border-radius: 4px; background: none; padding: 0; cursor: pointer; }
.pe-linked { flex: 1; color: var(--dim); font-style: italic; font-size: 11px; }
.pe-btn { flex: 1; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); text-align: left; padding: 0 8px; }
.pe-btn:hover { border-color: var(--accent); color: var(--accent); }
.pe-add { display: block; width: calc(100% - 16px); margin: 8px 8px 0; height: 28px; border-radius: 7px; border: 1px dashed var(--hover-bd); background: var(--panel); color: var(--accent); }
.pe-foot { display: flex; gap: 6px; padding: 10px 8px 0; }
.nd-row2 { gap: 6px; }
.nd-row2 .nd-file { flex: 1; text-align: center; }
:root[data-theme="light"] .part-ed { box-shadow: 0 12px 34px rgba(43,47,53,0.25); }
