/* lensed designer styles. */
/* Neutral grays, one accent, no gradients, shadows, or rounded cards. */

:root {
  --bg0: #161616;
  --bg1: #1d1d1d;
  --bg2: #242424;
  --bg3: #2c2c2c;
  --bg4: #363636;
  --line: #333333;
  --line2: #444444;
  --text: #c9c9c9;
  --text-hi: #e6e6e6;
  --text-dim: #8a8a8a;
  --text-faint: #5f5f5f;
  --accent: #e0a13a;
  --accent-dim: #7a5a26;
  --accent-bg: #3a2f1c;
  --error: #d0625a;
  --ok: #8fb07a;
  --ui-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
  --row: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg0);
  color: var(--text);
  font: 12px/1.35 var(--ui-font);
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }

/* App frame. */

#app {
  display: grid;
  grid-template-rows: 28px 1fr 20px;
  height: 100vh;
}

#bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

#bar .brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-hi);
  letter-spacing: 0.02em;
  margin-right: 12px;
  font-size: 13px;
}

#bar .sep { width: 1px; height: 16px; background: var(--line2); margin: 0 6px; }
#bar .grow { flex: 1; }
#bar select { max-width: 220px; }
#bar .rigname { color: var(--text-dim); margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  margin-left: 12px;
  white-space: nowrap;
}
.indicator::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--text-faint);
}
.indicator.on::before { background: var(--ok); }
.indicator.off::before { background: var(--error); }

#status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
}
#status .msg { flex: 1; overflow: hidden; text-overflow: ellipsis; }
#status .msg.error { color: var(--error); }

/* Pane layout. */

#layout {
  display: grid;
  grid-template-columns: var(--left-col, var(--left-w, 34%)) var(--left-split, 4px) minmax(0, 1fr) var(--rig-split, 4px) var(--rig-col, var(--rig-w, 440px));
  min-height: 0;
  min-width: 0;
}

/* Collapsed side columns: a 22 px strip that brings the column back, with no splitter beside it. */
#layout.left-collapsed { --left-col: 22px; --left-split: 0px; }
#layout.rig-collapsed { --rig-col: 22px; --rig-split: 0px; }
/* The splitter keeps its grid cell at zero width so the panes after it stay in their columns. */
#layout.left-collapsed #split-left, #layout.rig-collapsed #split-rig { visibility: hidden; pointer-events: none; }
#layout.left-collapsed #leftcol > :not(.col-strip) { display: none; }
#layout.rig-collapsed #pane-rig > :not(.col-strip) { display: none; }
#layout.left-collapsed #leftcol { display: flex; }
#layout.rig-collapsed #pane-rig { display: flex; }
.col-strip { display: none; }
#layout.left-collapsed #leftcol > .col-strip, #layout.rig-collapsed #pane-rig > .col-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 22px;
  height: 100%;
  padding: 6px 0;
  background: var(--bg2);
  border: none;
  color: var(--text-dim);
  cursor: default;
}
.col-strip:hover { background: var(--bg3); color: var(--text-hi); }
.col-strip svg { width: 11px; height: 11px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; }
.col-strip-label { writing-mode: vertical-rl; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.pane > header > .col-collapse { margin: 0 -2px; }

#leftcol {
  display: grid;
  grid-template-rows: var(--lens-h, 36%) 4px minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}

/* The lens diagram and the source map side by side at the top of the left column; the map takes the wider share. */
#lefttop {
  display: grid;
  grid-template-columns: var(--lens-w, 40%) 4px minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}

.splitter { background: var(--bg0); }
.splitter.v { cursor: col-resize; }
.splitter.h { cursor: row-resize; }
.splitter:hover, .splitter.drag { background: var(--accent-dim); }

.pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg1);
  transition: background 0.6s ease;
}
/* Briefly highlights the sources pane when the quick panel's plate row title is double clicked (ui/layout.js scrollAndFlash). */
.pane.flash { background: var(--accent-bg); transition: background 0.1s ease; }

.pane > header {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  align-items: center;
  gap: 2px 6px;
  min-height: 26px;
  flex: 0 0 auto;
  padding: 2px 6px;
  box-sizing: border-box;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.pane > header h2 {
  margin: 0 6px 0 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.pane > header .grow { flex: 1; }
/* Pane headers stay on one line: buttons and labels keep their size, while fields, readouts, and the growing item shrink. */
.pane > header > * { flex: none; }
.pane > header > .grow { flex: 1 1 0; min-width: 0; }
.pane > header > .scrub { flex: 0 1 64px; min-width: 36px; }
.pane > header > input[type="text"]:not(.scrub) { flex: 1 1 auto; min-width: 40px; }
.pane > header > .num { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pane > header .scrub { width: 64px; }
.pane > header .label { white-space: nowrap; }

.pane .body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.pane .body.scroll { overflow: auto; }

.pane .footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 22px;
  padding: 0 8px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
}

canvas.fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Controls. */

.btn {
  height: 20px;
  padding: 0 8px;
  background: var(--bg3);
  border: 1px solid var(--line2);
  border-radius: 0;
  color: var(--text);
  cursor: default;
  white-space: nowrap;
}
.btn:hover { background: var(--bg4); color: var(--text-hi); }
.btn:active { background: var(--accent-bg); border-color: var(--accent-dim); }
.btn:disabled { color: var(--text-faint); background: var(--bg2); }
.btn.flat { background: transparent; border-color: transparent; }
.btn.flat:hover { background: var(--bg3); border-color: var(--line2); }
.btn.icon { width: 20px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn.icon svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.btn.on { background: var(--accent-bg); border-color: var(--accent-dim); color: var(--accent); }

select, input[type="text"], .scrub {
  height: 20px;
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 4px;
  min-width: 0;
}
select:hover, input[type="text"]:hover { border-color: var(--line2); }
select:focus, input[type="text"]:focus, .scrub:focus { outline: none; border-color: var(--accent-dim); }
select { padding: 0 2px; }
select option { background: var(--bg2); }
input[type="text"] { font-size: 12px; }

input[type="checkbox"] {
  appearance: none;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1px solid var(--line2);
  background: var(--bg0);
  vertical-align: middle;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 3px;
  height: 6px;
  margin: 1px 0 0 3.5px;
  border: solid var(--bg0);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.scrub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-hi);
  text-align: right;
  cursor: ew-resize;
  width: 100%;
}
.scrub.editing { cursor: text; text-align: left; background: var(--bg0); }
.scrub.drag { border-color: var(--accent); color: var(--accent); }
.scrub.invalid { border-color: var(--error); }
.scrub.readonly { color: var(--text-dim); cursor: default; }

input[type="range"] {
  appearance: none;
  height: 20px;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line2); }
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 14px;
  margin-top: -6px;
  background: var(--text);
  border: none;
  border-radius: 0;
}
input[type="range"]:hover::-webkit-slider-thumb { background: var(--accent); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line2); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 14px; background: var(--text); border: none; border-radius: 0; }

.num { font-family: var(--mono); font-size: 12px; color: var(--text-hi); }
.dim { color: var(--text-dim); }
.label { color: var(--text-dim); }

/* Property groups in the rig panel. */

.group { border-bottom: 1px solid var(--line); }

.group > .ghead {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 6px;
  background: var(--bg2);
  color: var(--text-hi);
  font-weight: 600;
  cursor: default;
  user-select: none;
  transition: background 0.6s ease, color 0.6s ease;
}
/* Briefly highlights a rig panel group opened from the quick panel (ui/layout.js openGroup). */
.group.flash > .ghead { background: var(--accent-bg); color: var(--accent); transition: background 0.1s ease, color 0.1s ease; }
.group > .ghead:hover { background: var(--bg3); }
.group > .ghead .gswitch { margin: 0 2px 0 0; flex: none; }
.group.switched-off > .ghead > span:not(.count) { color: var(--text-dim); }
.group > .ghead .chev { width: 10px; height: 10px; stroke: var(--text-dim); fill: none; stroke-width: 1.5; }
.group.closed > .ghead .chev { transform: rotate(-90deg); }
.group > .ghead .count { margin-left: auto; font-weight: 400; color: var(--text-dim); font-family: var(--mono); }
.group.closed > .gbody { display: none; }
.group > .gbody { padding: 4px 6px 6px; }

.props {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
}
.props > label { color: var(--text-dim); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.props .multi { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; }
.props .inline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.props .inline > .scrub, .props .inline > select { flex: 1; }
.props .note { grid-column: 2; color: var(--text-faint); font-size: 11px; }
/* A heading inside a group: spans both columns, set apart by a rule above, in the high text color. */
.props .subhead {
  grid-column: 1 / -1;
  margin: 8px 0 2px;
  padding: 4px 0 2px 4px;
  border-top: 1px solid var(--line2);
  color: var(--text-hi);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.props .subhead:first-child { margin-top: 0; border-top: none; }
.props .readout { font-family: var(--mono); color: var(--text-dim); padding: 0 5px; }
/* Cost tag of a setting that slows the frame by about 2 times or more (host/web/ui/costs.js); its tooltip holds the measured cost. */
.cost { display: inline-block; margin-right: 4px; padding: 0 3px; border: 1px solid var(--accent-dim); border-radius: 2px; color: var(--accent); font-size: 10px; line-height: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; vertical-align: 1px; cursor: help; }
.cost-label { white-space: nowrap; }

.toolbar { display: flex; gap: 2px; align-items: center; padding: 3px 0; }
.toolbar .grow { flex: 1; }
.toolbar .label { margin: 0 4px; }

/* Dense tables. */

table.grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
table.grid th {
  height: 20px;
  padding: 0 4px;
  font-weight: 400;
  color: var(--text-dim);
  text-align: left;
  border-bottom: 1px solid var(--line2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.grid th.r { text-align: right; }
table.grid th.c { text-align: center; }
table.grid td { padding: 1px 1px; height: var(--row); border-bottom: 1px solid var(--bg2); }
table.grid td.idx { font-family: var(--mono); color: var(--text-dim); text-align: right; padding-right: 4px; }
table.grid td.c { text-align: center; }
table.grid td.txt { padding: 0 4px; font-family: var(--mono); color: var(--text-hi); }
table.grid tr.hover td { background: var(--bg3); }
table.grid tr.sel td { background: var(--accent-bg); }
table.grid tr.sel td.idx, table.grid tr.sel td.txt { color: var(--accent); }
table.grid tr.stop td.idx { color: var(--text-hi); }
table.grid select, table.grid .scrub { width: 100%; border-color: transparent; background: transparent; }
table.grid select:hover, table.grid .scrub:hover { border-color: var(--line2); background: var(--bg0); }
table.grid .scrub.editing, table.grid .scrub.drag { background: var(--bg0); }
table.grid tr.off td:not(.c) { opacity: 0.45; }
table.grid .tint { display: grid; grid-template-columns: 14px repeat(3, minmax(0, 1fr)); gap: 1px; align-items: center; }

.ghostlist { max-height: 340px; overflow: auto; border: 1px solid var(--line); }
.ghostlist table.grid th { position: sticky; top: 0; background: var(--bg1); z-index: 1; }

.swatch { width: 12px; height: 12px; border: 1px solid var(--line2); display: inline-block; }

.detail {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

/* Viewport. */

.viewport-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0d0d0d;
  cursor: grab;
}
.viewport-stage.panning { cursor: grabbing; }
.viewport-stage canvas.gpu {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  outline: 1px solid var(--line2);
}
.viewport-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
  white-space: pre-line;
  cursor: default;
}
.pane > header input[type="range"] { width: 120px; }

/* Sources pane. */

.sources-groups { flex: 0 1 auto; max-height: 62%; overflow-y: auto; border-bottom: 1px solid var(--line); }
.sources-groups .group > .gbody { padding: 3px 4px 5px; }
.sources-groups .props { grid-template-columns: 124px minmax(0, 1fr); }
.sources-groups .props .scrub { width: 100%; }
.sources-rows { display: flex; flex-direction: column; }
.sources-rows .row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 2px 6px; min-width: 0; }
/* Path fields share the row with icon buttons; they shrink to a readable minimum before the row wraps. */
.sources-rows .row > input[type="text"] { flex: 1 1 140px; min-width: 90px; }
/* A path row keeps its label, field, and buttons on one line; the field takes whatever width is left. */
.sources-rows .row.nowrap { flex-wrap: nowrap; }
.sources-rows .row.nowrap > input[type="text"] { flex: 1 1 0; min-width: 30px; }
.sources-rows .row.nowrap > .btn { flex: none; }
.sources-rows .row .label { white-space: nowrap; }
.sources-rows .row select { max-width: 160px; }
.sources-rows .row .scrub { width: 72px; }
.hidden { display: none !important; }

.drop-target::after {
  content: "Drop a rig, prescription, or plate";
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent);
  background: rgba(22, 22, 22, 0.75);
  color: var(--accent);
  font-size: 14px;
  pointer-events: none;
  z-index: 100;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--bg4); border: 2px solid var(--bg1); }
::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }
::-webkit-scrollbar-corner { background: var(--bg1); }

/* Rig panel notices. */

.notice {
  margin: 6px;
  padding: 4px 6px;
  border: 1px solid var(--accent-dim);
  background: var(--accent-bg);
  color: var(--text-hi);
}

/* Lens library, opened from the top bar. */

.library {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100vw - 8px));
  background: var(--bg1);
  border: 1px solid var(--line2);
}
.library.hidden { display: none; }
.lib-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.lib-head .lib-search { flex: 1; }
.lib-filters {
  padding: 6px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.lib-facets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lib-facet, .lib-num {
  background: var(--bg1);
  color: var(--text);
  border: 1px solid var(--line2);
  padding: 2px 4px;
  font: inherit;
  font-size: 11px;
}
.lib-num { width: 64px; }
.lib-clear {
  margin-left: auto;
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--line2);
  padding: 2px 6px;
  font-size: 11px;
  cursor: default;
}
.lib-clear:not(:disabled):hover { background: var(--bg3); color: var(--text-hi); }
.lib-clear:disabled { opacity: 0.4; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lib-chip {
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--line2);
  padding: 1px 6px;
  font-size: 11px;
  cursor: default;
}
.lib-chip:hover { background: var(--bg3); color: var(--text-hi); }
.lib-chip.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-dim); }
.lib-list { flex: 1 1 auto; min-height: 60px; overflow: auto; }
.lib-bhead {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 18px;
  padding: 0 6px 0 16px;
  color: var(--text-dim);
  font-size: 11px;
  border-bottom: 1px solid var(--bg2);
}
.lib-ghead {
  position: sticky;
  top: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  background: var(--bg2);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
.lib-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 40px 96px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  height: var(--row);
  padding: 0 6px;
  border-bottom: 1px solid var(--bg2);
  cursor: default;
}
.lib-row:hover { background: var(--bg3); }
.lib-row.cursor { background: var(--bg4); }
.lib-row.current { background: var(--accent-bg); }
.lib-row.current .lib-name { color: var(--accent); }
.lib-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-namecell { display: flex; gap: 6px; align-items: center; }
.lib-name { color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; }
.lib-tag {
  flex: none;
  padding: 0 4px;
  font-size: 11px;
  line-height: 14px;
  border: 1px solid var(--line2);
  color: var(--text-dim);
}
.lib-tag.warn, .lib-detail .warn { color: var(--error); border-color: var(--error); }
.lib-row.needs .lib-name { color: var(--text-dim); }
.lib-empty { padding: 8px; color: var(--text-dim); }
.lib-detail {
  flex: none;
  max-height: 30%;
  overflow: auto;
  padding: 4px 6px 6px;
  background: var(--bg2);
  border-top: 1px solid var(--line2);
}
.lib-dhead { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; cursor: pointer; }
.lib-dtoggle { margin-left: auto; }
.lib-detail.collapsed .lib-dhead { margin-bottom: 0; }
.lib-notes { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-more > summary { cursor: pointer; margin-top: 3px; }
.lib-dname { color: var(--text-hi); font-weight: 600; }
.lib-props {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 1px;
}
.lib-props > label { color: var(--text-dim); text-align: right; white-space: nowrap; }
.lib-props > span { overflow-wrap: anywhere; }
.lib-props a { color: var(--accent); text-decoration: none; }
.lib-props a:hover { text-decoration: underline; }

/* The library's gallery: the panel centered and wide, and each lens a card with its preview (panes/lensPreview.js). */
.library.gallery { width: min(1480px, calc(100vw - 16px)); height: calc(100vh - 48px); }
.lib-mode {
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--line2);
  padding: 2px 8px;
  font-size: 11px;
  cursor: default;
}
.lib-mode:hover { background: var(--bg3); color: var(--text-hi); }
.lib-mode.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-dim); }
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 8px;
  padding: 8px;
}
.lib-row.lib-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: 2px;
  height: auto;
  padding: 4px;
  border: 1px solid var(--line);
}
.lib-thumbbox { position: relative; aspect-ratio: 3 / 2; background: #000; overflow: hidden; }
.lib-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.lib-thumb:not([src]) { visibility: hidden; }
.lib-thumbnote { position: absolute; left: 6px; bottom: 4px; color: var(--text-dim); font-size: 11px; }
/* Live view of a gallery lens (panes/lensLive.js), over the library. */
.lens-live {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 0.6);
}
.lens-live.hidden { display: none; }
.live-box {
  display: flex;
  flex-direction: column;
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--bg1);
  border: 1px solid var(--line2);
}
.live-head, .live-foot { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: var(--bg2); }
.live-head { border-bottom: 1px solid var(--line); }
.live-foot { border-top: 1px solid var(--line); font-size: 11px; }
.live-head .grow, .live-foot .grow { flex: 1; }
.live-title { color: var(--text-hi); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-info { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-head input[type="range"] { width: 120px; }
.live-expvalue { width: 4ch; }
.live-frame { min-height: 0; display: flex; justify-content: center; background: #000; }
/* Sized by its width alone, so the drawing fills the element and a pointer position maps straight to the frame. */
.live-canvas { display: block; width: min(100%, calc((100vh - 110px) * 1.5)); height: auto; aspect-ratio: 3 / 2; cursor: crosshair; touch-action: none; }
.lib-card .lib-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-cardinfo { min-width: 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Floating dropdown panel shared by the Draft and playback settings buttons (panes/viewport.js, panes/transport.js). */

.layers-panel {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(460px, calc(100vw - 8px));
  background: var(--bg1);
  border: 1px solid var(--line2);
  padding: 2px 0;
}
.layers-panel.hidden { display: none; }
.ly-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--row);
  padding: 0 6px;
  cursor: default;
}
.ly-row:hover { background: var(--bg3); }

/* Quick panel (panes/quickbar.js): docked in the sources pane between its sections and the source map, with its sections stacked to fit the left column's width. */
/* The dock scrolls when the column is short, and the source map keeps at least 96 px; the header collapses the panel to one line. */
/* While the left column is collapsed the panel floats over the viewport image at bottom center (.floating), with Lens, Look, and Sources beside Layers. */

.quick-dock {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
  container: quick / inline-size;
}
.quick-dock:empty { display: none; }
#pane-map > .body { min-height: 96px; }
/* With the source map in its own pane, the sections take the height the quick panel leaves. */
#pane-sources > .sources-groups { flex: 1 1 0; max-height: none; min-height: 120px; }
.quickpanel {
  color: var(--text);
  font: 12px/1.35 var(--ui-font);
  user-select: none;
  outline: none;
}
.quickpanel.floating {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  margin: 0 auto;
  width: fit-content;
  max-width: calc(100% - 20px);
  max-height: calc(100% - 20px);
  overflow-y: auto;
  z-index: 15;
  background: rgba(29, 29, 29, 0.94);
  border: 1px solid var(--line2);
}
.qp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 22px;
  padding: 0 4px 0 8px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.qp-head:hover { background: var(--bg3); }
.qp-title { font-weight: 600; color: var(--text-hi); }
.qp-summary { color: var(--text-dim); font-size: 11px; white-space: pre; display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.quickpanel.collapsed .qp-summary { display: inline; }
.quickpanel.collapsed .qp-body { display: none; }
.quickpanel.collapsed .qp-head { border-bottom: none; }
.qp-collapse { border: none; }
.qp-collapse .chev { transform: rotate(0deg); }
.quickpanel.collapsed .qp-collapse .chev { transform: rotate(180deg); }
.qp-body { display: flex; flex-direction: column; gap: 8px; padding: 6px 8px 8px; }
.qp-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.quickpanel.floating .qp-body { flex-direction: row; flex-wrap: wrap; gap: 0 18px; padding: 6px 10px 8px; }
.quickpanel.floating .qp-col { width: 300px; }
.qp-section { display: flex; flex-direction: column; gap: 3px; }
.qp-section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  height: 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.qp-section-name { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.qp-section-check { margin: 0; }
.qp-section.switched-off > :not(.qp-section-title) { opacity: 0.45; }
.qp-count { margin-left: auto; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-dim); }
.qp-row { display: flex; align-items: center; gap: 8px; height: 20px; }
.qp-label { width: 70px; flex: none; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-range { flex: 1; min-width: 24px; margin: 0; }
.qp-row .scrub { width: 64px; flex: none; text-align: right; }
.qp-check { display: flex; align-items: center; gap: 6px; height: 20px; color: var(--text); }
.qp-check > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-check input, .qp-layer input[type="checkbox"] { margin: 0; flex: none; }
.qp-check.dim, .qp-row.dim > .qp-label { color: var(--text-faint); }
.qp-row.dim .qp-range, .qp-row.dim .scrub { opacity: 0.5; }
.qp-layer-label { display: flex; align-items: baseline; gap: 5px; width: 86px; flex: none; overflow: hidden; }
.qp-layer-name { width: auto; cursor: default; }
.qp-layer-name:hover { color: var(--text-hi); text-decoration: underline dotted var(--text-faint); }
.qp-layer-count { font-size: 11px; color: var(--text-dim); }
.qp-layer.dim .qp-layer-name { color: var(--text-faint); }
.qp-layer.solo .qp-layer-name { color: var(--accent); }
.qp-lens-row { gap: 2px; height: 22px; }
.qp-lens { flex: 1; min-width: 0; height: 22px; display: flex; align-items: center; gap: 8px; padding: 0 8px; text-align: left; }
.qp-lens-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-hi); }
.qp-lens-facts { flex: none; font-size: 11px; color: var(--text-dim); }
.qp-segs { display: inline-flex; }
.qp-seg { height: 20px; padding: 0 10px; }
.qp-seg + .qp-seg { margin-left: -1px; }
/* In the Input view nothing below the view row changes the image, so it is shown faded. */
.qp-body.input-only .qp-layer, .qp-body.input-only .qp-section:has(.qp-check) { opacity: 0.45; }
/* A left column of 560 px or more has room for Lens, Look, and Sources beside Layers, which halves the panel's height. */
@container quick (min-width: 560px) {
  .qp-body { flex-direction: row; gap: 0 16px; }
  .qp-col { flex: 1 1 0; }
}
/* A narrow left column gives the labels and fields less room, so the sliders keep a usable length. */
@container quick (max-width: 300px) {
  .qp-row { gap: 6px; }
  .qp-label { width: 58px; }
  .qp-layer-label { width: 74px; }
  .qp-row .scrub { width: 50px; }
  .qp-seg { padding: 0 8px; }
}
.viewport-stage.manual-on { cursor: crosshair; }

/* Host link (app.js openLink): the node the app was opened from, and the buttons that answer it. */
.link-label { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.link-label b { color: var(--text-hi); font-weight: 600; }
.btn.accept { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.accept:hover { background: var(--accent); filter: brightness(1.12); color: var(--bg); }
.link-done { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(18, 18, 18, 0.92); color: var(--text-hi); font-size: 14px; }
.viewport-stage.manual-on.panning { cursor: grabbing; }

/* Transport bar of the viewport for a frame sequence (panes/transport.js): the scrub bar over a row of controls. */
.transport {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
  padding: 4px 6px 3px;
  border-top: 1px solid var(--line);
  background: var(--bg2);
}
.transport.hidden { display: none; }
.transport .tp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; white-space: nowrap; }
.transport .tp-row .grow { flex: 1; }
.transport .tp-frame { min-width: 44px; text-align: right; color: var(--text-hi); }
.transport .tp-scrub { width: 100%; height: 16px; display: block; cursor: pointer; border: 1px solid var(--line); box-sizing: border-box; }
.transport .tp-eff { min-width: 64px; text-align: right; }
.transport .tp-mem { min-width: 120px; text-align: right; }
.row.dim.warn { color: var(--error); }
.btn.warn { color: var(--error); border-color: var(--error); }
.nowrap { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.track-progress { flex: 0 0 120px; height: 10px; }
table.grid tr.ghost-group td { background: var(--bg2); cursor: pointer; }
table.grid tr.ghost-group .chev { width: 10px; height: 10px; stroke: var(--text-dim); fill: none; stroke-width: 1.5; }
table.grid tr.ghost-group.closed .chev { transform: rotate(-90deg); }
table.grid tr.ghost-group .inline { display: flex; align-items: center; gap: 6px; width: 100%; }
table.grid tr.ghost-group .label { margin-left: auto; }
.qp-nogain { flex: 1; font-size: 11px; color: var(--text-faint); text-align: right; padding-right: 2px; }
.qp-layer input[type="checkbox"]:disabled + .qp-layer-label .qp-layer-name { color: var(--text-faint); }

/* An icon button that also shows a short value, such as the squeeze beside the desqueeze icon. */
.btn.icon .btn-note { margin-left: 3px; font-size: 11px; }
.btn.icon:has(.btn-note:not(:empty)) { width: auto; padding: 0 5px; }

/* A small icon standing in for a label in a pane header; the word is in its tooltip. */
.hdr-icon { display: inline-flex; align-items: center; color: var(--text-dim); }
.hdr-icon svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.5; }
