/* ═══════════════════════════════════════════════════
   Lumis (C4D panel) — dark blue tool UI
   ═══════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-root:        #0a0a0a;
  --bg-surface:     #111113;
  --bg-panel:       #141416;
  --bg-raised:      #1a1a1e;
  --bg-hover:       #1f1f24;
  /* Scrim stage backdrop only — dome / IES / paint keep --bg-root. Back near
     the old dark now that the preview carries its own hairline border. */
  --bg-stage:       #0c0c10;
  --bg-active:      rgba(41,121,255,0.10);
  --border:         rgba(255,255,255,0.06);
  --border-active:  rgba(255,255,255,0.12);
  --accent:         #2979FF;
  --accent-dim:     #1a5cbf;
  --accent-glow:    rgba(41,121,255,0.30);
  --accent-subtle:  rgba(41,121,255,0.08);
  --section-rail:   rgba(41,121,255,0.55);
  --text-primary:   #e8e8ea;
  --text-secondary: #94949e;
  --text-muted:     #4a4a52;
  --text-accent:    #5ea3ff;
  /* Linking uses muted semantic colours, separate from alerts/status. */
  --link-include:   #8faf9d;
  --link-exclude:   #c18f91;
  --link-include-rgb: 143,175,157;
  --link-exclude-rgb: 193,143,145;
  --success:        #34d399;
  --error:          #f87171;
  --warning:        #f59e0b; /* v35 */
  --danger:         #f87171;
  --text:           var(--text-primary);
  --text-dim:       var(--text-secondary);
  --lt-area:        #5ea3ff;
  --lt-spot:        #f59e0b;
  --lt-point:       #fb923c;
  --lt-dome:        #34d399;
  --lt-ies:         #a78bfa;
  --lt-infinite:    #e8e8ea;
  --lt-portal:      #67e8f9;
  --radius:         10px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  /* v38: shared motion scale (P1) — use for new rules; --tr kept for existing transitions */
  --dur-xs:         0.12s;
  --dur-sm:         0.18s;
  --dur-md:         0.26s;
  --dur-lg:         0.38s;
  --tr:             0.2s cubic-bezier(.22,.82,.28,1);
  --spring:         cubic-bezier(.22,.82,.28,1);
  /* Resizable layout (set by JS, persisted in localStorage) */
  --lp-sidebar-w:   80px;
  --lp-panel-w:     400px;
  --lp-handle-w:    4px;
  /* Mini scrim column + drawer (keep in sync with script.js fallback ms) */
  --lm-drawer-tr:   var(--dur-lg);
  --lm-drawer-ease: cubic-bezier(0.22, 0.82, 0.28, 1);
  --bg-base:        #08080a;
  --font-mono:      'Cascadia Code', 'Consolas', 'SF Mono', monospace;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 12px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* Default: don't let drags select chrome text. Text the user may want to
     copy (inputs, toast messages, light names) opts back in below. */
  user-select: none;
}

/* Allow text selection / copy where it is genuinely useful. */
input, textarea, .toast, .lm-name, .link-item-name {
  user-select: text;
  -webkit-user-select: text;
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2e; border-radius: 3px; }

/* Animate scrim column width (Chromium); others snap cleanly */
@property --lm-drawer-gap {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

/* ─── App Shell (modular, resizable like Cursor) ──── */
.app {
  --lm-drawer-w: 260px;
  --lm-drawer-gap: 0px;
  transition: --lm-drawer-gap var(--lm-drawer-tr) var(--lm-drawer-ease);
  display: grid;
  grid-template-rows: 48px minmax(0, max-content) 1fr 44px;
  grid-template-columns:
    var(--lp-sidebar-w)
    var(--lp-handle-w)
    minmax(0, 1fr)
    var(--lm-drawer-gap)
    var(--lp-handle-w)
    var(--lp-panel-w);
  grid-template-areas:
    "topbar  topbar  topbar  topbar  topbar  topbar"
    "licbn   licbn   licbn   licbn   licbn   licbn"
    "sidebar handle1 preview scrimGap handle2 panel"
    "footer  footer  footer  footer  footer  footer";
  height: 100vh;
  width: 100%;
  min-width: 0;
  gap: 0;
}

.app.lm-drawer-active {
  --lm-drawer-gap: var(--lm-drawer-w);
}

/* ─── Top Navigation Bar ─────────────────────────── */
.topbar {
  grid-area: topbar;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  column-gap: 14px;   /* the right group may grow (Update chip) — never let it kiss the nav */
  align-items: center;
  padding: 0 12px;
  background: rgba(17,17,19,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  min-width: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
}
.topbar-logo-hex {
  display: block;
  color: rgba(255, 255, 255, 0.88);
  flex-shrink: 0;
}
.topbar-logo-text {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.72);
}

.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--bg-raised);
  border-radius: 10px;
  padding: 3px;
  position: relative;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 38px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color var(--tr),
    background-color var(--tr),
    transform var(--tr);
  position: relative;
  z-index: 1;
}

/* ─── Lucide SVG icon utility ────────────────────── */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  pointer-events: none;
}

.nav-btn svg,
.nav-btn .icon,
.nav-btn .icon-raster { pointer-events: none; flex-shrink: 0; }

.nav-btn .nav-btn-icon {
  display: block;
  color: inherit;
}

/* ─── License banner (v36) ─────────────────────── */
.lp-license-banner {
  grid-area: licbn;
  padding: 5px 12px;
  text-align: center;
  font-size: 11px;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  z-index: 9;
}
.lp-license-banner[hidden] {
  display: none !important;
}
.lp-license-banner-txt strong {
  color: var(--text-secondary);
  font-weight: 600;
}
/* Capability banner (Redshift / render core missing) shares the licbn row. */
.cap-banner.is-blocking {
  color: var(--error);
  background: rgba(248, 113, 113, 0.12);
  border-bottom-color: rgba(248, 113, 113, 0.40);
}
.is-no-core {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.6);
}

/* ─── Setup → License panel (v46 license v2) ───── */
.lic-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  min-width: 0;
}
.lic-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-raised);
}
.lic-badge.is-ok    { color: var(--success); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.10); }
.lic-badge.is-trial { color: var(--text-accent); border-color: rgba(94, 163, 255, 0.4); background: var(--accent-subtle); }
.lic-badge.is-warn  { color: var(--warning); border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.10); }
.lic-badge.is-off   { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); }
.lic-meta {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lic-or {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.lic-or::before, .lic-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.lic-fine { font-size: 10.5px; }
.lic-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 2px 0 6px;
}
.lic-key-label { font-size: 10.5px; color: var(--text-muted); flex-shrink: 0; }
.lic-key-value {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
  -webkit-user-select: all;
}
.lic-link { color: var(--text-accent); text-decoration: none; }
.lic-link:hover { text-decoration: underline; }
.lic-seats { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.lic-seats:empty { display: none; }
.lic-seat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-size: 11px;
  min-width: 0;
}
.lic-seat.is-this { border-color: rgba(52, 211, 153, 0.35); }
.lic-seat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.lic-seat-seen { flex: none; font-size: 10px; color: var(--text-muted); }
.lic-seat-release { flex: none; padding: 2px 8px; font-size: 10px; }
.btn-sm.is-armed { color: var(--danger); border-color: rgba(248, 113, 113, 0.8); background: rgba(248, 113, 113, 0.14); }

.nav-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }

.nav-btn.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

/* v38: active tab — tiny corner dot (avoids clashing with centered SVG icons) */
.nav-btn.active::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent-glow);
  opacity: 0.85;
  pointer-events: none;
  z-index: 2;
}

.nav-btn .nav-tooltip {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
}

.nav-btn:hover .nav-tooltip { opacity: 1; }

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-undo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--tr), background var(--tr), border-color var(--tr);
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.topbar-icon-btn:active {
  transform: scale(0.98);
}

.topbar-undo-txt {
  letter-spacing: 0.02em;
}

@media (max-width: 760px) {
  .topbar-undo-txt { display: none; }
  .topbar-icon-btn { padding: 0 8px; }
}
/* With the Update chip showing, the right group is ~90 px wider — drop the
   Undo/Redo labels (icons stay) so the chip does not push into the nav. */
@media (max-width: 960px) {
  .topbar-right:has(.topbar-update:not([hidden])) .topbar-undo-txt { display: none; }
  .topbar-right:has(.topbar-update:not([hidden])) .topbar-icon-btn { padding: 0 8px; }
  /* the chip's tooltip carries "you have vX" — the badge is redundant here */
  .topbar-right:has(.topbar-update:not([hidden])) .topbar-badge { display: none; }
}
@media (max-width: 620px) {
  .topbar-update #topbar-update-txt { display: none; }
  .topbar-update { padding: 0 7px; }
}

.topbar-badge {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-raised);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}

/* Update chip — appears ONLY when the license server reports a newer build.
   Click → system browser (account page → download). There is no in-place
   installer: a loaded .pyp + NumPy .so cannot be swapped under C4D. */
.topbar-update {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.topbar-update:hover {
  background: rgba(52, 211, 153, 0.22);
  border-color: rgba(52, 211, 153, 0.7);
}
.topbar-update[hidden] { display: none; }

.about-update {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.about-update-txt {
  font-size: 11px;
  color: var(--text-secondary);
}
.about-update.is-available .about-update-txt {
  color: var(--text-primary);
  font-weight: 600;
}
.btn-sm.is-accent {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.10);
}
.btn-sm.is-accent:hover {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.7);
  background: rgba(52, 211, 153, 0.2);
}
/* `.btn-sm` / `.section-note` set display, which beats the UA's
   [hidden]{display:none} — the green "Get update" button sat next to
   "You're on the latest version". Same trap as .stage-section[hidden]. */
.btn-sm[hidden] { display: none !important; }

/* ─── Left Sidebar (Presets) — resizable ─────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  min-height: 0;
}

.sidebar-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 6px 0 2px;
  writing-mode: horizontal-tb;
}

.preset-thumb {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg-raised);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--tr),
    box-shadow var(--tr);
  position: relative;
  flex-shrink: 0;
}

.preset-thumb:hover { border-color: var(--border-active); }

.preset-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.preset-thumb canvas, .preset-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 2px);
}

/* 12 scrim thumbs — scrollable column so a short panel never lets the
   tiles overflow on top of the action buttons below. */
.sidebar-presets {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 0 8px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-browse-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: calc(100% - 12px);
  margin: 2px 6px 6px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1px solid var(--border-active);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
}
.sidebar-browse-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-browse-btn .icon { flex-shrink: 0; }

.sidebar-tip {
  display: block;
  text-align: center;
  font-size: 9px;
  color: var(--text-muted);
  padding: 0 6px 6px;
}
.sidebar-tip kbd {
  display: inline-block;
  font-family: inherit;
  font-size: 8px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 14px;
}
.preset-thumb.has-override::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-surface);
  z-index: 2;
  pointer-events: none;
}

/* ─── Resize handles (drag to resize panels) ─────── */
.resize-handle {
  background: transparent;
  cursor: col-resize;
  width: var(--lp-handle-w);
  min-width: var(--lp-handle-w);
  position: relative;
  /* Above mini scrim / preview so drag hits the handle, not “outside” the drawer hit-area */
  z-index: 30;
  transition: background var(--tr);
}
.resize-handle::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  background: transparent;
  border-radius: 2px;
  transition: background var(--tr);
}
.resize-handle:hover,
.resize-handle.dragging {
  background: rgba(41,121,255,0.12);
}
.resize-handle:hover::after,
.resize-handle.dragging::after {
  background: var(--accent);
  opacity: 0.9;
}
.resize-handle[data-area="handle1"] { grid-area: handle1; }
.resize-handle[data-area="handle2"] { grid-area: handle2; }

/* Horizontal resize (content height) */

/* ─── Center: Night Sky Visualization ────────────── */
.preview {
  grid-area: preview;
  background: #020208;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/* Dedicated grid slot for mini scrim UI — steals width from 1fr preview (modular), no padding hacks */
.lm-scrim-gap {
  grid-area: scrimGap;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
}
.preview canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─── Center stages (Paint help / Scrim / Dome / IES) ─
   Shares the preview slot with the night sky: the active page shows one
   stage, Mixer + Linking keep the night sky. */
.stage-view {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-root);
}
/* Scrim only: its texture is a full-frame black square, so a black backdrop
   swallowed the edges. The dome globe and IES cone read fine on --bg-root. */
#scrim-stage {
  background: var(--bg-stage);
}
.stage-view[hidden] { display: none; }
.preview.stage-on > #nightsky-cv,
.preview.stage-on > .nightsky-tip { display: none; }
/* Stage chrome shared by the four center stages */
.stage-bar-name {
  font-size: 11px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 45%;
}
.stage-bar-meta {
  font-size: 9px;
  letter-spacing: 0.3px;
  color: var(--text-accent);
  opacity: 0.8;
  white-space: nowrap;
}
.stage-band {
  flex-shrink: 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.stage-shape-row {
  min-width: 0;
  gap: 4px;
}
.stage-shape-row .shape-btn {
  padding: 4px 6px;
  font-size: 9px;
  min-height: 26px;
}

/* Stages keep the panel's section rhythm */
.stage-section { padding: 0 10px; }
.stage-section > .section-header { margin-top: 6px; }
.stage-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding-bottom: 6px;
}
.stage-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 14px;
}
.stage-scroll > .guide-hint { margin: 0 10px 2px; }

/* Terse two-column reference rows — same kbd chips as the panel tips */
.guide-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 3px 12px;
  padding: 2px 2px 4px;
}
.guide-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  font-size: 10px;
  line-height: 18px;
  color: var(--text-muted);
}
.guide-row kbd {
  display: inline-block;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}
.guide-row b {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.guide-rows--defs { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.guide-hint .hint-text { font-size: 10px; }
.guide-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(41,121,255,0.10);
  border: 1px solid rgba(41,121,255,0.22);
  white-space: nowrap;
}
.guide-chip b {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-accent);
}
.guide-chip i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.guide-chip.is-edit {
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.26);
}
.guide-chip.is-edit b { color: var(--lt-spot); }

/* The visual hero of a stage: scrim circle, HDR globe, IES cone.
   The hero must stay square in a panel that is resized on both axes, so it
   is sized off the container box (cq units) with a width-driven fallback
   for engines without size container queries. */
.stage-fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
}
.stage-hero {
  container-type: size;
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Two-class prefix on purpose: the universal selector adds no specificity, so
   a plain `.stage-hero > *` loses to same-specificity rules further down the
   file — `.preview canvas` (height:100% → elliptical globe) and
   `.scrim-preview-box` (width:100% → hero taller than its box, overlapping the
   shape row above and the caption below). */
.stage-view .stage-hero > *,
.stage-view .stage-hero > canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  flex: 0 0 auto;
}
@supports (width: 1cqh) {
  .stage-view .stage-hero > *,
  .stage-view .stage-hero > canvas { width: min(100cqw, 100cqh); }
}
.stage-fill-note,
.stage-fill-name {
  flex-shrink: 0;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-fill-name {
  font-size: 11px;
  color: var(--text-primary);
}
.stage-fill-note {
  font-size: 9px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.4;
}
#scrim-stage .scrim-preview-box {
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.75);
  /* Hairline is what separates the black texture from the dark stage — it does
     the job the lighter backdrop used to do. */
  border: 1px solid var(--border-active);
}
#dome-stage .dome-hdr-globe {
  background: radial-gradient(circle at 50% 34%, rgba(90,130,255,0.10), rgba(2,2,8,0) 66%), #050509;
}
.ies-stage-cone {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 50% 34%, rgba(90,130,255,0.12), rgba(2,2,8,0) 66%), #050509;
  border: 1px solid var(--border);
  overflow: hidden;
}
#ies-stage-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ies-stage-cone .ies-stage-empty {
  width: 64px;
  height: 64px;
  aspect-ratio: auto;
  color: rgba(255,255,255,0.07);
}
.ies-stage-cone:has(#ies-stage-preview:not([hidden])) .ies-stage-empty { display: none; }

/* A section is display:flex, so the plain [hidden] attribute needs help */
.stage-section[hidden] { display: none; }

/* Library footers — collapse from their own section header */
.stage-lib > .section-header { gap: 8px; }
.stage-lib-folder {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 9px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.stage-lib .hdr-lib-strip,
.stage-lib .ies-lib-strip {
  max-height: 190px;
  overflow-y: auto;
  flex-wrap: wrap;
  align-content: flex-start;
}

.stage-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.stage-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
.stage-div {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}
.stage-bar-spacer { flex: 1 1 auto; min-width: 0; }

/* v46: keep IDs for JS, hide Suggest / catalog / Setup builder */
.lp-retired { display: none !important; }

.stage-ref {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 5px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.stage-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.stage-group--slider { flex: 0 1 150px; }
.stage-group[hidden], .stage-div[hidden] { display: none; }
.stage-group--slider input[type="range"] { flex: 1; min-width: 60px; }
.stage-group-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}
.stage-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 78px;
  font-size: 10px;
  padding: 4px 20px 4px 6px;
}

.stage-count {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  overflow: hidden;
}
.stage-count-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
}
.stage-count-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.stage-count-val {
  min-width: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stage-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 30%, rgba(41, 121, 255, 0.05), transparent 62%),
    #050609;
}
.stage-canvas { display: block; width: 100%; height: 100%; }

/* Floating HUD chips */
.stage-hud {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 100px;
  background: rgba(8, 9, 14, 0.82);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 10px;
  color: var(--text-secondary);
  pointer-events: none;
  white-space: nowrap;
}
.stage-hud[hidden] { display: none; }
.stage-hud b {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.stage-hud span:not(.stage-hud-dot) { color: var(--text-muted); }
.stage-hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.stage-hud--quiet {
  background: rgba(8, 9, 14, 0.6);
  border-color: transparent;
  color: var(--text-muted);
}
.stage-hud--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border-radius: var(--radius-md);
  padding: 8px 11px 9px;
}
.stage-hud-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-hud-sep {
  width: 1px;
  height: 9px;
  background: var(--border);
}
.stage-hud--tl { top: 12px; left: 12px; }
.stage-hud--tr { top: 12px; right: 12px; }
.stage-hud kbd {
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 15px;
}

/* Selected-light inspector — docks bottom so it never covers the marker */
.stage-inspect {
  position: absolute;
  top: auto;
  bottom: 52px;
  right: 12px;
  left: auto;
  z-index: 7;
  width: 220px;
  max-height: min(280px, calc(100% - 110px));
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 11px 11px;
  border-radius: var(--radius-md);
  background: rgba(17, 17, 21, 0.96);
  border: 1px solid var(--border-active);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}
.stage-inspect.stage-inspect--left {
  right: auto;
  left: 12px;
}
.stage-inspect[hidden] { display: none; }
.stage-inspect .ctrl-label { min-width: 52px; font-size: 10px; flex-shrink: 0; }
.stage-inspect .slider-val {
  font-size: 10px;
  min-width: 40px;
  flex-shrink: 0;
  text-align: right;
}
.stage-inspect .ctrl-row {
  min-height: 22px;
  gap: 6px;
}
.stage-inspect .slider-wrap {
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}
.stage-inspect input[type="range"] {
  min-width: 0;
  flex: 1 1 auto;
  width: 100%;
  pointer-events: auto;
}
.stage-inspect-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.stage-inspect-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.stage-inspect-name {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-inspect-x {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--tr), background var(--tr);
}
.stage-inspect-x:hover { color: var(--error); background: rgba(248, 113, 113, 0.1); }
.stage-inspect-flip {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.stage-inspect-flip:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.08); }
.stage-inspect-flip[hidden] { display: none; }
.stage-inspect-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.1);
  font-size: 9px;
  line-height: 1.3;
  color: var(--warning);
}
.stage-inspect-warn[hidden] { display: none; }
.stage-inspect-warn svg { flex-shrink: 0; }
.stage-inspect-warn .btn-sm {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 9px;
}

.btn-sm.is-on {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text-accent);
}

/* Legend + dock */
.stage-legend {
  position: absolute;
  left: 12px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  color: var(--text-muted);
  pointer-events: none;
}
.stage-legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.stage-legend-sep {
  width: 1px;
  height: 10px;
  background: var(--border);
}
.stage-legend-note { opacity: 0.8; }

.stage-dock {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage-dock-primary { padding: 8px 16px; }
.stage-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 100px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.12);
  font-size: 10px;
  font-weight: 500;
  color: var(--warning);
  white-space: nowrap;
}
.stage-warn[hidden] { display: none; }

/* Empty state — no subject, or no painted key yet */
.stage-blank {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: rgba(5, 6, 9, 0.86);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: var(--text-muted);
}
.stage-blank[hidden] { display: none; }
.stage-blank svg { opacity: 0.35; margin-bottom: 2px; }
.stage-blank h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.stage-blank p {
  max-width: 300px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-muted);
}
.stage-blank .btn-sm { margin-top: 6px; }
.stage-blank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 0 0 auto;
}
/* Product picker must NOT flex-grow — .ctrl-select { flex:1 } inside the
   full-height blank column was stretching into that giant empty blue box. */
.stage-blank-product {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  max-width: 280px;
}
.stage-blank-product .stage-product-label {
  margin-top: 0;
  flex-shrink: 0;
}
.stage-blank-product .stage-product-select,
.stage-blank .stage-product-select {
  flex: 0 0 auto;
  width: 200px;
  max-width: 200px;
  height: 28px;
  margin-top: 0;
  align-self: center;
}
.stage-product-label {
  margin-top: 8px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stage-product-select {
  width: min(240px, 100%);
  margin-top: 4px;
  font-size: 11px;
  padding: 6px 28px 6px 8px;
}

/* ─── Rig proposals (measured from the product) ──────────────────── */
.stage-rigs {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 12;
  width: 236px;
  max-height: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(9, 11, 16, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.stage-rigs[hidden] { display: none; }
.stage-rigs-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 8px 6px 10px;
}
.stage-rigs-title {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-rigs-title b { color: var(--text-secondary); font-weight: 600; }
.stage-rigs-product {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 8px;
}
.stage-rigs-product label {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stage-rigs-product .stage-product-select {
  flex: 1 1 auto;
  width: auto;
  height: 28px;
  margin-top: 0;
  min-width: 0;
  align-self: center;
}
.stage-rigs-shape {
  flex-shrink: 0;
  padding: 0 10px 8px;
  font-size: 9px;
  line-height: 1.55;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.stage-rigs-shape em { color: var(--accent); font-style: normal; font-weight: 600; }
.stage-rigs-unsure {
  flex-shrink: 0;
  margin: 0 6px 4px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  font-size: 9px;
  line-height: 1.45;
  color: var(--warning);
}
.stage-rigs-unsure[hidden] { display: none; }
.stage-rigs-list {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.stage-rig {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr);
}
.stage-rig:hover { border-color: var(--accent); background: rgba(255, 255, 255, 0.05); }
.stage-rig.is-on { border-color: var(--accent); background: rgba(96, 165, 250, 0.1); }
.stage-rig-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
}
.stage-rig-count {
  font-size: 8px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.stage-rig-why {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--text-muted);
}


/* ─── Scrim Library overlay (slides over the night sky) ─────────── */
.scrim-lib-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  transform: translateX(-101%);
  visibility: hidden;
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s linear 0.24s;
}
.scrim-lib-overlay.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0s;
}
.scrim-lib-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.scrim-lib-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--tr), color var(--tr);
}
.scrim-lib-back:hover { background: var(--bg-hover); color: var(--text-primary); }
.scrim-lib-title {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.scrim-lib-addfolder {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-active);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--tr), color var(--tr);
}
.scrim-lib-addfolder:hover { background: var(--bg-hover); color: var(--text-primary); }
.scrim-lib-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 16px;
}
.scrim-lib-section { margin-bottom: 14px; }
.scrim-lib-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}
.scrim-lib-section-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.scrim-lib-section-folder {
  flex: 1 1 auto;
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scrim-lib-section-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.scrim-lib-section-remove:hover { color: var(--text-primary); border-color: var(--border-active); }
.scrim-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.scrim-lib-empty-msg {
  font-size: 10px;
  color: var(--text-muted);
  padding: 6px 2px;
}
.scrim-lib-tile {
  position: relative;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg-raised);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.scrim-lib-tile:hover { border-color: var(--border-active); }
.scrim-lib-tile.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.scrim-lib-tile canvas,
.scrim-lib-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--radius-sm) - 2px);
}
.scrim-lib-tile-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.85);
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  padding: 8px 3px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.scrim-lib-star {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
  box-sizing: border-box;
  background: rgba(0,0,0,0.32);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.scrim-lib-tile:hover .scrim-lib-star,
.scrim-lib-star.fav { opacity: 1; }
.scrim-lib-star .lp-lib-heart {
  width: 13px;
  height: 13px;
  display: block;
  pointer-events: none;
}
.scrim-lib-star:not(.fav) .lp-lib-heart-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linejoin: round;
}
.scrim-lib-star.fav .lp-lib-heart-path {
  fill: currentColor;
  stroke: none;
}
.scrim-lib-star:hover {
  color: #fff;
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.42);
  transform: scale(1.08);
}
.scrim-lib-star.fav {
  color: #ff1744;
  background: rgba(255,80,100,0.22);
  border-color: rgba(255,140,155,0.55);
}
.nightsky-tip {
  position: absolute;
  display: none;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 10px;
  background: rgba(6,7,12,.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none;
  z-index: 10;
}
.nightsky-tip b {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,.88);
  letter-spacing: .03em;
  margin-bottom: 4px;
}
.nightsky-tip span {
  font-size: 9px;
  letter-spacing: .05em;
  color: rgba(255,255,255,.34);
}

/* ─── Right Panel — resizable ────────────────────── */
.panel {
  grid-area: panel;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.panel-page { display: none; flex-direction: column; gap: 12px; }
.panel-page.active { display: flex; }

/* Section */
.section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: background var(--tr);
}
.section-header:hover {
  background: rgba(255,255,255,0.02);
}

.section-header .chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform var(--tr);
  flex-shrink: 0;
}

.section-header.collapsed .chevron { transform: rotate(-90deg); }

.section-header:not(.collapsed) {
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  transition: max-height 0.3s var(--spring), opacity 0.22s ease;
  max-height: 800px;
  opacity: 1;
}

/* collapsed state handled by premium CSS at end of file */

/* Right-panel sections: a header bar with the body hung under it on a blue
   rail, so where one section ends and the next begins reads at a glance even
   with every section open. The stage column keeps the bare style above. */
.panel-page > .section { gap: 0; }
.panel-page > .section > .section-header {
  position: sticky;
  top: -12px; /* .panel-scroll padding: stick to the visible top edge */
  z-index: 3;
  padding: 7px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.panel-page > .section > .section-header:hover { background: var(--bg-hover); }
.panel-page > .section > .section-header:not(.collapsed) {
  padding-left: 7px;
  border-left: 2px solid var(--section-rail);
  border-bottom-color: transparent;
  border-radius: 8px 8px 0 0;
}
.panel-page > .section > .section-header:not(.collapsed) .section-title { color: var(--text-primary); }
.panel-page > .section > .section-header:not(.collapsed) .chevron { color: var(--text-accent); }
.panel-page > .section > .section-body {
  padding: 8px 8px 10px 7px;
  border: 1px solid var(--border);
  border-top: none;
  border-left: 2px solid var(--section-rail);
  border-radius: 0 0 8px 8px;
  background: rgba(255,255,255,0.012);
  transition: max-height var(--dur-md) var(--spring), opacity var(--dur-sm) ease,
              padding var(--dur-md) var(--spring), border-width var(--dur-md) var(--spring);
}
/* A collapsed body stays in flow at max-height 0; drop its frame too. */
.panel-page > .section > .section-header.collapsed + .section-body {
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

/* Control Row */
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
  gap: 8px;
  min-width: 0;
}

.ctrl-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.ctrl-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 60px;
  flex-shrink: 0;
}

.ctrl-label.active { color: var(--text-accent); }

/* Toggle switch */
.toggle {
  position: relative;
  width: 32px; height: 17px;
  border-radius: 100px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  cursor: pointer;
  transition:
    background-color var(--tr),
    border-color var(--tr);
  flex-shrink: 0;
}

.toggle.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--tr);
}

.toggle.on::after { transform: translateX(15px); }

/* Checkbox-based toggle (used in section headers) */
.toggle-sm {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-sm input { display: none; }
.toggle-track {
  position: relative;
  width: 28px; height: 15px;
  border-radius: 100px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  transition:
    background-color var(--tr),
    border-color var(--tr);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--tr);
}
.toggle-sm input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-sm input:checked + .toggle-track::after {
  transform: translateX(13px);
}

/* Slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.slider-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Word readouts ("Horizontal", "Diagonal") need more room than a number,
   and must not shove the slider around as the word changes. */
.slider-val-wide {
  min-width: 62px;
}

/* Numeric fields stay visible, including idle controls and mixer drawers. */
input.slider-val {
  width: 58px;
  min-width: 48px;
  flex: 0 0 58px;
  margin: 0;
  padding: 1px 3px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-raised);
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: text;
  -webkit-appearance: none;
  appearance: none;
}
input.slider-val:hover {
  border-color: var(--border);
  background: var(--bg-raised);
}
input.slider-val:focus {
  border-color: var(--accent);
  background: var(--bg-raised);
  color: var(--text-primary);
  outline: none;
}
.ctrl-row.axis-muted input.slider-val {
  pointer-events: none;
}

input[type="range"] {
  -webkit-appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 100px;
  background: linear-gradient(to right,
    var(--accent) 0%,
    var(--accent) var(--pct, 50%),
    rgba(255,255,255,0.06) var(--pct, 50%),
    rgba(255,255,255,0.06) 100%
  );
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 6px var(--accent-glow), 0 1px 4px rgba(0,0,0,0.5);
  transition: transform var(--tr), box-shadow var(--tr);
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 10px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 6px var(--accent-glow);
}

/* Select dropdown */
.ctrl-select {
  appearance: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 24px 5px 8px;
  cursor: pointer;
  transition: border-color var(--tr), color var(--tr), background-color var(--tr);
  flex: 1;
  min-width: 0;
  max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' fill='none'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23555' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.ctrl-select:hover { border-color: var(--border-active); }
.ctrl-select:focus { outline: none; border-color: var(--accent); }
.ctrl-select option { background: #1a1a1e; }
#btn-parent-null-add { flex: 0 0 auto; }
#btn-parent-null-add.on {
  color: #3da9fc; border-color: #3da9fc;
}

/* Text input */
.ctrl-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  padding: 5px 8px;
  flex: 1;
  transition: border-color var(--tr);
}

.ctrl-input:focus { outline: none; border-color: var(--accent); }
.ctrl-input::placeholder { color: var(--text-muted); }

/* Color swatch.
   We strip the native WebKit chrome (appearance + padding + default
   background) so the input renders as a clean colored rectangle driven
   entirely by ::-webkit-color-swatch. Without these overrides C4D's
   embedded WebKit falls back to a broken text rendering that shows the
   hex value as raw characters instead of the color itself. */
.color-swatch,
.ctrl-color {
  width: 32px; height: 22px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border-active);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  overflow: hidden;
}
.color-swatch::-webkit-color-swatch-wrapper,
.ctrl-color::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch,
.ctrl-color::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Small button */
.btn-sm {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--tr),
    color var(--tr),
    background-color var(--tr),
    transform var(--tr);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-sm:hover { border-color: var(--border-active); color: var(--text-primary); background: var(--bg-hover); }
.btn-sm.btn-icon {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Shape buttons */
.shape-row {
  display: flex;
  gap: 4px;
}

.shape-btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--tr),
    color var(--tr),
    background-color var(--tr),
    box-shadow var(--tr),
    transform var(--tr);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.shape-btn .shape-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
}

.shape-btn:hover { border-color: var(--border-active); color: var(--text-secondary); }

.shape-btn.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text-accent);
}

/* Scrim shape row — mirrors .shape-row layout */
.sc-shape-row {
  display: flex;
  gap: 5px;
  margin-bottom: 6px;
}

/* Axis-muted: visually indicates this slider has no effect in the current
   scrim shape (e.g. Spread X / Tilt H when shape is "horizontal").
   Slider stays enabled — it still works if the user adds Rotation. */
.ctrl-row.axis-muted .ctrl-label,
.ctrl-row.axis-muted .slider-val {
  opacity: 0.38;
  transition: opacity 0.2s;
}
.ctrl-row.axis-muted input[type="range"] {
  opacity: 0.35;
  transition: opacity 0.2s;
}

/* Button row */
.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Sweep (light orbit) — Paint page */
.sweep-status {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  padding: 2px 0 4px;
}
.sweep-status.is-on { color: var(--text-accent, #5ea3ff); }
.sweep-pivot-name {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: center;
}
.sweep-hint,
.hlock-hint {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  padding: 0 0 6px;
}
/* State strip: a dot carries the lock state at a glance, the way the Dome
   page reads its own connection state. */
.hlock-state {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
  background: var(--bg-panel);
}
.hlock-state-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background-color var(--tr), box-shadow var(--tr);
}
.hlock-state.is-on .hlock-state-dot {
  background: var(--accent);
  box-shadow: 0 0 7px rgba(41, 121, 255, 0.75);
}
.hlock-state.is-hidden-anchor .hlock-state-dot {
  background: var(--warning);
  box-shadow: 0 0 7px rgba(245, 158, 11, 0.7);
}
.hlock-status {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hlock-state.is-on .hlock-status { color: var(--text-accent, #5ea3ff); }
.hlock-state.is-hidden-anchor .hlock-status { color: var(--warning); }

/* Pick / Last Hit are the two ways into a lock, so they get the same card
   treatment as the paint modes rather than reading as generic buttons. */
.hlock-row {
  display: flex;
  gap: 4px;
}
.hlock-btn {
  position: relative;
  flex: 1;
  padding: 8px 4px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  transition:
    border-color var(--tr),
    color var(--tr),
    background-color var(--tr),
    box-shadow var(--tr),
    transform var(--tr);
}
.hlock-btn:hover {
  border-color: var(--border-active);
  color: var(--text-secondary);
  background: var(--bg-hover);
  transform: translateY(-1px);
}
.hlock-btn:active { transform: scale(0.97); }
/* An icon well gives these the same visual weight as the paint-mode rasters;
   a bare 17px stroke icon read as disabled next to them. */
.hlock-btn-icon {
  width: 27px;
  height: 27px;
  margin-bottom: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
  transition: color var(--tr), background-color var(--tr), border-color var(--tr);
}
.hlock-btn:hover .hlock-btn-icon {
  color: var(--text-accent, #5ea3ff);
  background: rgba(41, 121, 255, 0.12);
  border-color: rgba(41, 121, 255, 0.28);
}
.hlock-btn.on .hlock-btn-icon {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.hlock-btn-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.hlock-btn-sub {
  font-size: 8px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}
.hlock-btn.on {
  border-color: var(--accent);
  background: rgba(41, 121, 255, 0.14);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(41, 121, 255, 0.12);
}
.hlock-btn.on .hlock-btn-sub { color: var(--accent); opacity: 0.7; }

/* Clear removes work, Bake replaces animation: both stay small and tinted
   only on hover so neither competes with Pick. */
.hlock-util-row {
  display: flex;
  gap: 4px;
}
.hlock-util {
  flex: 1;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--tr), color var(--tr), background-color var(--tr);
}
.hlock-util:active { transform: scale(0.97); }
.hlock-util--clear:hover { border-color: var(--error); color: var(--error); background: rgba(239, 68, 68, 0.10); }
.hlock-util--bake:hover { border-color: var(--accent); color: var(--accent); background: rgba(41, 121, 255, 0.10); }
.hlock-shortcut-tips .sc-row { min-width: 96px; }
.hlock-hud {
  display: flex;
  gap: 4px;
  font-size: 9px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-muted);
}
.hlock-hud-item {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50%;
}
#sec-hlock:not(.has-lock) #hlock-body [data-needs-lock] {
  opacity: 0.4;
}
#btn-sweep-pick.on {
  background: var(--accent-subtle, rgba(41, 121, 255, 0.10));
  border-color: rgba(41, 121, 255, 0.40);
  color: #fff;
}
#sweep-pivot-seg {
  display: flex;
  flex: 1;
  gap: 3px;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}
#sweep-pivot-seg button {
  flex: 1;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 10px;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
}
#sweep-pivot-seg button.on {
  background: var(--accent-subtle, rgba(41, 121, 255, 0.10));
  border-color: rgba(41, 121, 255, 0.40);
  color: #fff;
}
#sec-sweep.is-off #sweep-body [data-needs-rig] {
  opacity: 0.4;
  pointer-events: none;
}
/* Sweep is parked for v2: the whole section is a dead, greyed label. The
   header cannot be expanded and the body never renders, so the controls are
   genuinely unreachable — a dimmed-but-open panel read as "broken" rather
   than "not yet". Enforced in JS too (a CSS-only lock is one devtools click
   away, and the click handler would still fire). */
#sec-sweep.is-v2 { display: none !important; }
#sec-sweep.is-v2 .section-header { cursor: default; border-left: none; padding-left: 6px; }
#sec-sweep.is-v2 .section-header:hover { background: none; }
#sec-sweep.is-v2 .section-header .chevron { visibility: hidden; }
#sec-sweep.is-v2 .section-body { display: none !important; }
.v2-badge {
  margin-left: auto;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}
#row-sweep-spread.is-off {
  opacity: 0.4;
  pointer-events: none;
}

.btn-action {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--tr), color var(--tr), background var(--tr), transform var(--tr);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-action:hover { border-color: var(--border-active); color: var(--text-primary); background: var(--bg-hover); }

/* Mixer Record (AutoKey) toggle button. The dot mirrors the C4D timeline
   AutoKey LED: red when actively recording (either C4D or plugin toggle),
   amber when the plugin toggle is on but C4D AutoKey is off (i.e. only
   the mixer would create keys), and gray when idle. */
.rec-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-tertiary, #6a6f78);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: background var(--tr), box-shadow var(--tr);
}
#btn-mixer-record.rec-active {
  border-color: #d23a3a;
  color: #f5b8b8;
  background: rgba(210, 58, 58, 0.12);
}
#btn-mixer-record.rec-active .rec-dot {
  background: #e84444;
  box-shadow: 0 0 6px rgba(232, 68, 68, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
#btn-mixer-record.rec-pending .rec-dot {
  background: #e8a544;
  box-shadow: 0 0 5px rgba(232, 165, 68, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* Sticky preview + shortcut legend scroll together */
.scrim-sticky-block {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg-panel);
  padding-bottom: 2px;
  margin-bottom: 2px;
}

/* Scrim preview — no border so light fills the square (matches OSL, no 1px “frame”) */
.scrim-preview-box {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.55);
}

.scrim-shortcut-tips {
  margin: 4px 0 0;
}

.scrim-preview-box canvas {
  width: 100%; height: 100%;
}
#scrim-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}
.scrim-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  white-space: nowrap;
  z-index: 5;
}
.scrim-hint.visible {
  opacity: 1;
}
.btn-overlay-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17,17,19,0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
  z-index: 5;
  opacity: 0.85;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.btn-overlay-toggle:hover { opacity: 1; background: rgba(30,30,35,0.95); }
.btn-overlay-toggle.off { color: var(--text-muted); opacity: 0.45; }

/* ─── Footer / Status Bar ─────────────────────────── */
.footer {
  grid-area: footer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Default = offline until Python confirms (see .ready / .offline) */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.status-dot.offline {
  background: var(--error);
  box-shadow: 0 0 8px rgba(248,113,113,0.55);
  animation: none;
}

.status-dot.ready {
  background: var(--success);
  box-shadow: 0 0 8px rgba(52,211,153,0.55);
  animation: none;
}

.status-dot.busy {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: status-busy 0.75s ease-in-out infinite;
}

.status-dot.idle {
  background: #4b5563;
  box-shadow: 0 0 5px rgba(75,85,99,0.4);
  animation: status-idle 3s ease-in-out infinite;
}

@keyframes status-idle {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.status-dot.error {
  background: #dc2626;
  box-shadow: 0 0 8px rgba(248,113,113,0.6);
  animation: none;
}

@keyframes status-busy {
  0%, 100% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.2; transform: scale(0.88); }
  60% { opacity: 1; transform: scale(1.05); }
}

.status-text {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bridge-chip {
  flex: 0 0 auto;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.03em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.bridge-chip.is-fallback {
  color: #f5b45a;
  border-color: rgba(245, 180, 90, 0.35);
  background: rgba(245, 180, 90, 0.08);
}

.footer-btn {
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color var(--tr),
    box-shadow var(--tr),
    transform var(--tr);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 12px var(--accent-glow);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

.footer-btn:hover {
  background: #3a8aff;
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.footer-btn:active { transform: translateY(0); }

/* ─── Physical button feedback (scale on press) ──── */
.btn-action:active,
.btn-sm:active,
.mode-btn:active,
.shape-btn:active,
.lm-drawer-back:active,
.link-item-remove:active,
.lm-solo-btn:active,
.lm-mute-btn:active,
.lm-om-btn:active,
.lm-scrim-btn:active { transform: scale(0.97); }

.nav-btn:active { transform: scale(0.88); }

.footer-btn.loading { opacity: 0.7; pointer-events: none; }

.footer-btn .spinner {
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.6s linear infinite;
}

.footer-btn.loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(18,18,22,0.95);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 8px 16px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1000;
  max-width: min(520px, 94vw);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
  text-align: left;
  overflow: hidden;
  box-sizing: border-box;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ─── Paint Mode Selector ────────────────────────── */
#paint-rim-controls { margin-top: 8px; }
#paint-rim-controls[hidden] { display: none; }
.rim-angle-help { margin: 5px 0 8px; font-size: 10px; line-height: 1.5; color: var(--text-muted); }
.mode-row {
  display: flex;
  gap: 4px;
}

.mode-btn {
  position: relative;
  flex: 1;
  padding: 8px 4px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  transition:
    border-color var(--tr),
    color var(--tr),
    background-color var(--tr),
    box-shadow var(--tr),
    transform var(--tr);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

/* Discrete slot index — pairs with Ctrl+1…4 (tooltip on whole button) */
.mode-key {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0;
  color: var(--text-muted);
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}
.mode-btn:hover .mode-key {
  opacity: 0.65;
}
.mode-btn.active .mode-key,
.mode-btn.edit .mode-key {
  opacity: 0.85;
  color: inherit;
}

.mode-btn:hover {
  border-color: var(--border-active);
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.mode-btn.active {
  border-color: var(--accent);
  background: rgba(41,121,255,0.14);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(41,121,255,0.12);
}

/* Per-mode accent tint on active (create) state */
.mode-btn[data-mode="specular"].active { border-color: var(--lt-area); color: var(--lt-area); background: rgba(94,163,255,0.12); }

.mode-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.mode-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.mode-sub {
  font-size: 8px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.2px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.mode-btn.active .mode-sub {
  opacity: 0.6;
}

.mode-sub.sub-flip {
  opacity: 0;
  transform: translateY(-4px);
}

/* Edit state — orange accent */
.mode-btn.edit {
  border-color: var(--lt-spot);
  background: rgba(245, 158, 11, 0.10);
  color: var(--lt-spot);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.12);
}
.mode-btn.edit .mode-sub {
  opacity: 0.65;
  color: var(--lt-spot);
}
.mode-btn.edit:hover {
  border-color: var(--lt-spot);
  background: rgba(245, 158, 11, 0.16);
  color: var(--lt-spot);
}
.mode-btn[data-mode="shadow"].active,
.mode-btn[data-mode="shadow"].edit {
  border-color: var(--lt-spot);
  background: rgba(245, 158, 11, 0.10);
  color: var(--lt-spot);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.12);
}
.mode-btn[data-mode="shadow"].active .mode-sub,
.mode-btn[data-mode="shadow"].edit .mode-sub {
  opacity: 0.65;
  color: var(--lt-spot);
}

/* Paint mode hint */
.mode-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  background: rgba(41,121,255,0.07);
  border: 1px solid rgba(41,121,255,0.18);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  margin-top: 2px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.mode-hint.hint-edit {
  background: rgba(245,158,11,0.07);
  border-color: rgba(245,158,11,0.22);
}

.mode-hint.hidden { display: none; }

.hint-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}
.mode-hint.hint-edit .hint-icon {
  color: var(--lt-spot);
}

.hint-text {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.hint-text strong {
  color: var(--text-accent);
  font-weight: 600;
}
.mode-hint.hint-edit .hint-text strong {
  color: var(--lt-spot);
}

/* ─── Section note ───────────────────────────────── */
.section-note {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.45;
  padding: 2px 0 4px;
}

/* ─── Setup → Diagnostics / Preferences / Help / About ───────────── */
.env-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.env-row {
  display: grid;
  grid-template-columns: 8px auto minmax(0, 1fr);
  align-items: baseline;
  gap: 7px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--text-secondary);
  min-width: 0;
}
.env-row.is-muted { color: var(--text-muted); grid-template-columns: 8px minmax(0, 1fr); }
.env-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  align-self: center;
}
.env-row.is-ok .env-dot { background: var(--success); }
.env-row.is-bad .env-dot { background: var(--error); box-shadow: 0 0 6px rgba(248,113,113,0.5); }
.env-row.is-bad .env-title { color: var(--error); }
.env-title { font-weight: 600; white-space: nowrap; }
.env-detail {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.env-row.is-bad .env-detail { color: var(--text-secondary); white-space: normal; }
.pref-row { padding: 3px 0; }
.help-steps {
  margin: 2px 0 8px;
  padding-left: 16px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.help-steps li { margin-bottom: 5px; }
.help-steps li strong { color: var(--text-primary, #e4e4e7); }
.help-steps li em { font-style: normal; color: var(--text-accent); }
.help-steps kbd {
  font: inherit;
  font-size: 9.5px;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
}
.about-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 2px;
}
#about-support-1 { cursor: pointer; }

/* ─── Shortcut tips ─────────────────────────────── */
.shortcut-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 1px 10px;
  padding: 5px 8px;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
}
.paint-shortcut-tips .decal-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border, #444);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.paint-shortcut-tips .decal-step:hover,
.paint-shortcut-tips .decal-step:focus-visible {
  color: var(--text, #eee);
  border-color: var(--accent, #6da5ef);
}
.paint-shortcut-tips {
  margin-top: 8px;
}
.shortcut-tips kbd.tip-create,
.mode-hint .tip-create {
  color: var(--accent);
  border-color: rgba(41, 121, 255, 0.35);
  background: rgba(41, 121, 255, 0.12);
}
.shortcut-tips kbd.tip-edit,
.mode-hint .tip-edit {
  color: var(--lt-spot);
  border-color: rgba(245, 158, 11, 0.40);
  background: rgba(245, 158, 11, 0.12);
}
.mode-hint .tip-create,
.mode-hint .tip-edit {
  font-weight: 700;
}
.shortcut-tips .sc-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  min-width: 120px;
}
.shortcut-tips kbd {
  display: inline-block;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 16px;
  white-space: nowrap;
}

/* ─── Light Manager ──────────────────────────────── */
/* ─── Light Mixer search bar ─────────────────────── */
.lm-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: 2px 4px 6px 4px;
}
.lm-search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
  opacity: .75;
}
.lm-search {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-primary, #eaeaea);
  font-size: 11px;
  line-height: 14px;
  padding: 4px 22px 4px 24px;
  outline: none;
  transition: border-color .12s, background .12s;
}
.lm-search:focus {
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
}
.lm-search::placeholder {
  color: var(--text-muted);
  opacity: .7;
}
.lm-search-clear {
  position: absolute;
  right: 9px;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 14px;
  padding: 0;
  display: none;
  border-radius: 3px;
}
.lm-search-clear:hover {
  color: var(--text-primary, #eaeaea);
  background: rgba(255,255,255,.08);
}
.lm-search-wrap.has-query .lm-search-clear { display: block; }
.lm-row.lm-hidden-by-search,
.lm-folder.lm-hidden-by-search { display: none !important; }
/* While a search is active, temporarily force folder bodies open so matches
   inside collapsed groups are visible without disturbing user's manual state. */
.lm-list.lm-searching .lm-folder-body.is-collapsed { display: block !important; }

.lm-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px 4px 4px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.lm-col-drag {
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lm-col-solo,
.lm-col-mute,
.lm-col-om {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.lm-col-scrim {
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: -0.04em;
}


/*
 * Mini scrim panel — inside .lm-scrim-gap grid column (width = --lm-drawer-gap).
 * Night sky preview column narrows like when dragging the panel handle — no vertical squash.
 */
.lm-scrim-drawer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: 0;
  box-shadow: -3px 0 18px rgba(0, 0, 0, 0.35);
  visibility: hidden;
  transform: translateX(100%);
  transition:
    transform var(--lm-drawer-tr) var(--lm-drawer-ease),
    visibility 0s linear var(--lm-drawer-tr);
  pointer-events: none;
  overflow: hidden;
}

.lm-scrim-drawer.is-open {
  visibility: visible;
  transform: translateX(0);
  transition:
    transform var(--lm-drawer-tr) var(--lm-drawer-ease),
    visibility 0s linear 0s;
  pointer-events: auto;
}

.lm-drawer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lm-drawer-back {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition:
    border-color var(--tr),
    color var(--tr),
    background-color var(--tr),
    transform var(--tr);
}

.lm-drawer-back svg {
  transform: rotate(90deg);
}

.lm-drawer-back:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.lm-drawer-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lm-drawer-pane[hidden] {
  display: none !important;
}

.lm-drawer-sub {
  margin: 0 0 4px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.lm-drawer-preview-box--thumb {
  min-height: 72px;
  max-height: 110px;
  padding: 0;
  background: var(--bg-root);
}

/* Dome drawer: globe fills the same square tile as scrim preview (inscribed circle). */
.lm-drawer-preview-box--dome-globe {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  min-height: 0;
}

.lm-drawer-preview-box--dome-globe .dome-hdr-globe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.lm-drawer-globe-hint {
  margin: 0 0 4px;
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

.lm-drawer-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

/* Square OSL preview (1:1) — edge-to-edge canvas, no outline ring */
.lm-drawer-preview-box {
  flex-shrink: 0;
  box-sizing: border-box;
  width: min(180px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: none;
  overflow: hidden;
  margin: 0 auto 4px;
}

.lm-drawer-preview-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.lm-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lm-drawer-ctrl {
  margin-bottom: 0;
}

.lm-drawer-ctrl .ctrl-label {
  min-width: 52px;
  font-size: 10px;
}

.lm-drawer-ctrl .slider-wrap input[type="range"] {
  height: 3px;
}

.lm-col-name {
  flex: 1 1 auto;
  min-width: 48px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lm-col-type {
  flex: 0 0 auto;
  width: 38px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lm-col-int {
  flex: 0 0 auto;
  width: 116px;
  min-width: 116px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lm-col-spread {
  flex: 0 0 auto;
  width: 116px;
  min-width: 116px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lm-col-color {
  flex: 0 0 auto;
  width: 30px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

/* Scroll container so many lights + folders stay usable */
.lm-list-scroll {
  max-height: min(52vh, 480px);
  min-height: 100px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
  margin-top: 2px;
}

.lm-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: visible;
  padding: 4px 2px;
  min-height: 0;
}

/* Null folder (Layer Manager–style) */
.lm-folder {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
  margin: 1px 0;
}
.lm-folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  cursor: default;
  user-select: none;
}
.lm-folder-header--drop,
.lm-folder-header--drop-into {
  outline: 2px solid rgba(41, 121, 255, 0.65);
  background: rgba(41, 121, 255, 0.12);
}
.lm-row.lm-row--drop-into {
  outline: 2px solid rgba(41, 121, 255, 0.65);
  outline-offset: -2px;
  background: rgba(41, 121, 255, 0.12);
}
.lm-folder-header--drop-before {
  outline: 2px solid rgba(94, 234, 212, 0.75);
  background: rgba(94, 234, 212, 0.1);
  box-shadow: inset 0 3px 0 rgba(94, 234, 212, 0.55);
}
.lm-folder-header--drop-after {
  outline: 2px solid rgba(251, 191, 36, 0.75);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: inset 0 -3px 0 rgba(251, 191, 36, 0.55);
}
.lm-folder-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.lm-folder-toggle:hover {
  color: var(--text-accent);
  background: var(--bg-hover);
}
.lm-folder-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ec8ff;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lm-folder-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 4px 6px 10px;
  min-height: 8px;
}
.lm-folder-body.is-collapsed {
  display: none;
}

/* A light that parents lights: its row heads the group, children hang off a guide line. */
.lm-lgroup {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lm-lgroup-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 12px;
  padding-left: 6px;
  border-left: 1px solid rgba(41, 121, 255, 0.35);
}
.lm-lgroup-body.is-collapsed { display: none; }
.lm-list.lm-searching .lm-lgroup-body.is-collapsed { display: flex !important; }
.lm-lgroup-toggle {
  width: 14px;
  height: 16px;
  flex: 0 0 14px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
}
.lm-lgroup-toggle:hover { color: var(--text-accent); background: var(--bg-hover); }
.lm-row.rs-disabled .lm-lgroup-toggle { pointer-events: auto; }
.lm-lgroup-count {
  flex-shrink: 0;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(41, 121, 255, 0.16);
  color: #9ec8ff;
  font-size: 8px;
  font-weight: 700;
  line-height: 13px;
}
.lm-lgroup-count[hidden] { display: none; }

/* Past two nesting levels groups stop indenting (the header names the parent). */
.lm-folder.lm-nest-flat {
  border-left: none;
  border-right: none;
  border-radius: 0;
}
.lm-folder.lm-nest-flat > .lm-folder-body { padding-left: 0; padding-right: 0; }
.lm-lgroup.lm-nest-flat > .lm-lgroup-body { margin-left: 0; padding-left: 3px; }

.lm-folder-solo {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.55;
}
.lm-folder-solo:hover {
  color: var(--text-accent);
  background: var(--bg-hover);
  opacity: 1;
}
.lm-folder-solo.on {
  color: var(--text-accent);
  opacity: 1;
}

.lm-grp-chip {
  padding: 0 5px;
  margin-left: 4px;
  border: 1px solid rgba(158, 200, 255, 0.30);
  border-radius: 999px;
  background: rgba(158, 200, 255, 0.08);
  color: #9ec8ff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 14px;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
}
.lm-grp-chip:hover {
  border-color: rgba(158, 200, 255, 0.6);
  background: rgba(158, 200, 255, 0.16);
}
.lm-grp-chip.on {
  color: #fff;
  border-color: var(--text-accent);
  background: var(--accent-subtle, rgba(41, 121, 255, 0.18));
}

/* Pointer-sort gap (live reflow) — minimal chrome, no fade tricks */
.lm-sort-placeholder {
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid rgba(41, 121, 255, 0.35);
  background: transparent;
  box-sizing: border-box;
  margin: 1px 0;
}

.lm-empty {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px 20px;
  line-height: 1.6;
}
.lm-empty-icon {
  display: block;
  margin: 0 auto 6px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* Light row */
.lm-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 4px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--tr),
    border-color var(--tr);
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.lm-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.lm-row.selected {
  background: var(--accent-subtle);
  border-color: rgba(41,121,255,0.25);
}

.lm-row.muted {
  opacity: 0.4;
}

.lm-row.rs-disabled {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(60%);
  position: relative;
}
/* Parent uses pointer-events: none (inherited) — re-enable row controls so M/S/OM stay clickable */
.lm-row.rs-disabled .lm-solo-btn,
.lm-row.rs-disabled .lm-mute-btn,
.lm-row.rs-disabled .lm-om-btn {
  pointer-events: auto;
}
.lm-row.rs-disabled::after {
  content: "RS off";
  font-size: 9px;
  color: #888;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  letter-spacing: 0.03em;
}

/* During reorder: kill row/folder transitions so list reflow feels instant (no opacity dimming). */
.lm-list.lm-reordering .lm-row,
.lm-list.lm-reordering .lm-folder,
.lm-list.lm-reordering .lm-drag-handle {
  transition: none !important;
}

.lm-row--ptr-source {
  pointer-events: none;
}

@keyframes lm-row-land {
  0% {
    background: rgba(41, 121, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(41, 121, 255, 0.3);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}
.lm-row--landed {
  animation: lm-row-land 0.28s ease-out;
}

.lm-row.lm-in-group {
  border-left: 2px solid rgba(41, 121, 255, 0.28);
  padding-left: 3px;
  margin-left: 1px;
}

/* Drag reorder handle (HTML5 DnD → light_reorder) */
.lm-drag-handle {
  width: 16px;
  height: 22px;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--tr), background var(--tr);
  font-family: inherit;
}
.lm-drag-handle:hover {
  color: var(--text-secondary);
  background: var(--bg-raised);
}
.lm-drag-handle:active {
  cursor: grabbing;
}
.lm-drag-handle:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

/* Solo / Mute / OM scroll icon buttons inside row */
.lm-solo-btn,
.lm-mute-btn,
.lm-om-btn {
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    border-color var(--tr),
    background-color var(--tr),
    color var(--tr),
    transform var(--tr);
  font-family: inherit;
  padding: 0;
}

.lm-solo-btn:hover { border-color: #f59e0b; color: #f59e0b; }
.lm-solo-btn.on    { background: #f59e0b; border-color: #f59e0b; color: #000; }

.lm-mute-btn:hover { border-color: var(--error); color: var(--error); }
.lm-mute-btn.on    { background: var(--error); border-color: var(--error); color: #fff; }

.lm-om-btn:hover { border-color: var(--accent); color: var(--accent); }

.lm-scrim-btn {
  width: 26px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    border-color var(--tr),
    background-color var(--tr),
    color var(--tr),
    transform var(--tr);
  font-family: inherit;
  padding: 0;
}

.lm-scrim-btn:hover {
  border-color: rgba(41, 121, 255, 0.55);
  color: var(--text-accent);
}

.lm-edit-btn--none {
  visibility: hidden;
  pointer-events: none;
}

.lm-name {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 1.2em;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
}

/* Name + SC badge tight together (no flex gap stretching) */
.lm-name-core {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
}

/* Immediate Null parent name, shown before SC (and next to light name) */
.lm-null-inline {
  flex-shrink: 0;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ec8ff;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(41, 121, 255, 0.35);
  background: rgba(41, 121, 255, 0.1);
}

.lm-name-text {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lm-group-tag {
  flex-shrink: 0;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 7px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.3;
}
.lm-group-tag.is-null {
  color: #8ec5ff;
  border-color: rgba(41, 121, 255, 0.4);
  background: rgba(41, 121, 255, 0.12);
}

.lm-type {
  flex: 0 0 auto;
  width: 38px;
  font-size: 9px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lm-int-wrap {
  flex: 0 0 auto;
  width: 116px;
  min-width: 116px;
  overflow: visible;
}

.lm-spread {
  flex: 0 0 auto;
  width: 116px;
  min-width: 116px;
  font-size: 9px;
  font-weight: 400;
  color: var(--text-muted);
  text-align: center;
  overflow: visible;
}

.lm-param-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.lm-int-field {
  width: 34px;
  flex-shrink: 0;
  padding: 1px 2px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  text-align: right;
  outline: none;
  font-family: inherit;
}
.lm-int-field:hover, .lm-spread-field:hover { border-color: var(--border); }
.lm-int-field:focus, .lm-spread-field:focus {
  background: var(--bg-raised);
  border-color: var(--accent);
  color: var(--text-primary);
}
/* Record arm — single red dot (DAW convention). No outer ring. */
.lm-key-btn {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
}
.lm-key-btn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5c2a2a;
  transition: background var(--tr), transform var(--tr);
}
.lm-key-btn:hover .lm-key-btn-dot {
  background: var(--danger);
}
.lm-key-btn.on .lm-key-btn-dot {
  background: var(--danger);
}
.lm-key-btn:focus-visible {
  outline: 1px solid var(--border-active);
  outline-offset: 1px;
}/* Paint-page light-linking section: the picker collects meshes, + / − decide the side. */
.lm-link-card-note {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
}
.lm-link-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.lm-link-btn {
  height: 22px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--tr), color var(--tr), background var(--tr), box-shadow var(--tr);
}
.lm-link-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.lm-link-btn:active { transform: scale(0.97); }
/* Include / Exclude carry their colour without hover, so the two directions
   are readable before the user probes them. */
.lm-link-btn--inc, .lm-link-btn--exc { flex: 1; justify-content: center; }
.lm-link-sign { font-size: 13px; line-height: 1; }
.lm-link-btn--inc { border-color: rgba(var(--link-include-rgb),0.35); color: var(--link-include); }
.lm-link-btn--exc { border-color: rgba(var(--link-exclude-rgb),0.32); color: var(--link-exclude); }
.lm-link-btn--inc:hover { border-color: var(--link-include); color: var(--link-include); background: rgba(var(--link-include-rgb),0.10); }
.lm-link-btn--exc:hover { border-color: var(--link-exclude); color: var(--link-exclude); background: rgba(var(--link-exclude-rgb),0.10); }
.lm-link-btn--pick { border-color: rgba(41,121,255,0.35); color: var(--text-accent, #5ea3ff); }
.lm-link-btn--inc.on {
  border-color: var(--link-include);
  background: rgba(var(--link-include-rgb),0.18);
  color: var(--link-include);
}
.lm-link-btn--exc.on {
  border-color: var(--link-exclude);
  background: rgba(var(--link-exclude-rgb),0.16);
  color: var(--link-exclude);
}
.lm-link-btn--pick.on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px var(--accent-glow);
}
.lm-link-target {
  min-width: 0;
  flex: 1;
  font-size: 10px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}
.lm-link-target.is-empty { color: var(--text-muted); font-style: italic; }
.lm-link-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-raised);
  overflow: hidden;
}
.lm-link-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}
.lm-link-panel-hint {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 9px;
}
.lm-link-list {
  max-height: 160px;
  overflow-y: auto;
  padding: 4px;
  min-height: 36px;
}
.lm-link-list .link-item {
  background: var(--bg-panel);
}
.lm-link-list .lm-empty {
  padding: 10px 6px;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

.lm-spread-field {
  width: 34px;
  flex-shrink: 0;
  padding: 1px 2px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  text-align: right;
  outline: none;
  font-family: inherit;
}

/* Value bar: the fill shows the value, the row's text field sits on top of it.
   Gestures live in createLmBar; the field only takes the mouse while typing. */
.lm-bar {
  --lm-bar-fill: rgba(41, 121, 255, 0.55);
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 18px;
  border-radius: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.lm-bar--spread { --lm-bar-fill: rgba(105, 182, 255, 0.42); }
.lm-bar:hover { border-color: var(--border-active); }
.lm-bar.dragging {
  border-color: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.lm-bar.editing { cursor: text; border-color: var(--accent); }
.lm-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--lm-bar-fill);
  pointer-events: none;
}
.lm-bar.editing .lm-bar-fill { opacity: 0.25; }
.lm-bar .lm-int-field,
.lm-bar .lm-spread-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  cursor: inherit;
}
.lm-bar.editing .lm-int-field,
.lm-bar.editing .lm-spread-field {
  pointer-events: auto;
  background: transparent;
  text-shadow: none;
}
.lm-row.rs-disabled .lm-bar { cursor: default; }

.lm-color-dot {
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border-active);
  flex-shrink: 0;
  cursor: pointer;
  -webkit-appearance: none;
  padding: 0;
  background: #fff;
  transition: box-shadow 0.3s ease;
}

.lm-color-wrap {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
}

/* Hide default color input chrome — show only the color rect */
.lm-color-dot::-webkit-color-swatch-wrapper { padding: 0; }
.lm-color-dot::-webkit-color-swatch { border: none; border-radius: 3px; }

/* ─── Color popover ─── */
.lm-color-popover {
  position: fixed;
  z-index: 9000;
  width: 240px;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-active);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lm-color-popover-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lm-color-popover-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  width: 34px;
  flex-shrink: 0;
}
.lm-color-hex-input {
  width: 64px;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-base);
  color: var(--text-primary);
  text-align: center;
}
.lm-color-hex-input:focus {
  border-color: var(--accent);
  outline: none;
}
.lm-color-native {
  width: 24px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border-active);
  border-radius: 3px;
  cursor: pointer;
  -webkit-appearance: none;
  background: none;
}
.lm-color-native::-webkit-color-swatch-wrapper { padding: 0; }
.lm-color-native::-webkit-color-swatch { border: none; border-radius: 2px; }

/* ── Inline HSV color wheel (SV square + hue strip) ─────────────────────
   Rendered by window._lpColorWheel(). Cursors are absolutely positioned
   inside the flex column box and translated to center on the hit point. */
.lm-color-wheel-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.lp-color-wheel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
}
.lp-color-wheel__sv-box,
.lp-color-wheel__hue-box {
  position: relative;
  border-radius: 4px;
  overflow: visible;
  border: 1px solid var(--border);
  background: var(--bg-base);
}
.lp-color-wheel__sv,
.lp-color-wheel__hue {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  border-radius: 3px;
}
.lp-color-wheel__sv-cursor {
  position: absolute;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.75), 0 1px 2px rgba(0,0,0,0.6);
  pointer-events: none;
  transition: none;
}
.lp-color-wheel__hue-cursor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.75);
  pointer-events: none;
  transition: none;
}
.lm-color-wheel-row.disabled-section {
  opacity: 0.4;
  pointer-events: none;
}

/* Fallback swatch popover (scrim / "default color" / any .color-swatch). */
.lp-swatch-popover {
  position: fixed;
  z-index: 10050;
  min-width: 212px;
}

/* Kelvin slider with gradient track */
.lm-kelvin-slider {
  -webkit-appearance: none;
  flex: 1;
  min-width: 0;
  height: 14px;
  outline: none;
  background: transparent;
  cursor: pointer;
  margin: 0;
  padding: 0;
}
.lm-kelvin-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right,
    #ff8a14 0%,
    #ffc06e 15%,
    #ffecd0 30%,
    #ffffff 45%,
    #d4e4ff 65%,
    #a6c8ff 80%,
    #7eaaff 100%
  );
  border: 1px solid rgba(255,255,255,0.08);
}
.lm-kelvin-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--lm-k-thumb, #fff);
  border: 2px solid #111;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35), 0 1px 4px rgba(0,0,0,0.55);
  transition: background 0.08s linear;
}
.lm-kelvin-field {
  width: 44px;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  padding: 2px 3px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-base);
  color: var(--text-primary);
  text-align: center;
}
.lm-kelvin-field:focus {
  border-color: var(--accent);
  outline: none;
}
.lm-kelvin-unit {
  font-size: 9px;
  color: var(--text-muted);
}

/* Mode toggle buttons */
.lm-color-mode-group {
  display: flex;
  flex: 1;
  gap: 4px;
}
.lm-color-mode-btn {
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 0;
  border: 1px solid var(--border-active);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text-secondary, var(--text-muted));
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lm-color-mode-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}
.lm-color-mode-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(41, 121, 255, 0.3);
}
.lm-color-mode-btn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

/* Disabled state for kelvin / color sections inside popover */
.lm-color-popover .disabled-section {
  opacity: 0.3;
  pointer-events: none;
}

/* Light type icon — semantic colour per type */
.lm-type-icon {
  margin-right: 3px;
  font-size: 10px;
  opacity: 0.85;
}
.lm-type[data-lt="area"]     .lm-type-icon { color: var(--lt-area); }
.lm-type[data-lt="spot"]     .lm-type-icon { color: var(--lt-spot); }
.lm-type[data-lt="point"]    .lm-type-icon { color: var(--lt-point); }
.lm-type[data-lt="dome"]     .lm-type-icon { color: var(--lt-dome); }
.lm-type[data-lt="ies"]      .lm-type-icon { color: var(--lt-ies); }
.lm-type[data-lt="distant"]  .lm-type-icon { color: var(--lt-infinite); }
.lm-type[data-lt="portal"]   .lm-type-icon { color: var(--lt-portal); }

/* Scrim badge on light name */
.lm-scrim-badge {
  flex-shrink: 0;
  display: inline-block;
  margin-left: 0;
  padding: 0 3px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 13px;
  background: rgba(41,121,255,0.18);
  color: var(--text-accent);
  border-radius: 3px;
  vertical-align: middle;
}

/* ─── Light Linking ──────────────────────────────── */
.link-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px 0;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  user-select: none;
  -webkit-user-select: none;
}

.link-item-name {
  flex: 1;
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-item-remove {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  padding: 0;
  transition:
    color var(--tr),
    background-color var(--tr),
    transform var(--tr);
}

.link-item-remove:hover { color: var(--error); background: rgba(248,113,113,0.1); }

.link-item--include, .link-item--include .link-item-name { color: var(--link-include); }
.link-item--exclude, .link-item--exclude .link-item-name { color: var(--link-exclude); }
.link-item { cursor: default; }

/* Per-row Light / Shadow / Affect-Children toggles. Mirrors the three
   column icons in the RS Attribute Manager (Project tab): icon in muted
   color = bit ON (function active, RS "neutral"); icon in red = bit OFF
   (function overridden by user, RS "red"). */
.link-item-flags {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-right: 2px;
}

.ll-flag-toggle {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  color: var(--text-muted);
  transition:
    color var(--tr),
    background-color var(--tr),
    transform var(--tr);
}

.ll-flag-toggle .icon { width: 12px; height: 12px; display: block; }

.ll-flag-toggle.is-active:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.ll-flag-toggle.is-off {
  color: var(--link-exclude);
  background: rgba(var(--link-exclude-rgb),0.10);
}
.ll-flag-toggle.is-off:hover {
  background: rgba(var(--link-exclude-rgb),0.18);
}

.ll-flag-toggle:active { transform: scale(0.92); }

/* ─── By Object linking ──────────────────────────── */
/* One row per light, answering "does this reach the selected object". The dot
   is the whole interaction; name and solo are secondary affordances. */
.link-list--tall { max-height: 260px; }

/* ── By Object: object header, orbit, capsules ─────────────────────────── */
.ll-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0 6px;
}
.ll-pin {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--tr), border-color var(--tr), background var(--tr);
}
.ll-pin:hover { color: var(--text-secondary); background: var(--bg-hover); }
.ll-pin.on {
  color: var(--warning);
  border-color: rgba(245,158,11,0.42);
  background: rgba(245,158,11,0.12);
}
.ll-obj {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ll-count {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.ll-count b { color: var(--accent); font-weight: 600; }

.ll-orbit {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
}

.ll-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
}
.ll-cap {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 3px 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr), color var(--tr);
}
.ll-cap:hover { background: var(--bg-hover); border-color: var(--border-active); }
.ll-cap.is-on { color: var(--text-primary); border-color: rgba(255,255,255,0.18); }
.ll-cap.is-inherited { border-style: dashed; }
/* Reaches the object with no rule behind it — held back so authored
   Include/Exclude entries are the ones that read as configured. */
.ll-cap.is-default { color: var(--text-secondary); border-color: var(--border); }
.ll-cap.is-default .ll-cap-dot { opacity: 0.45; }
.ll-cap.is-muted .ll-cap-name { text-decoration: line-through; opacity: 0.65; }
.ll-cap-dot {
  width: 8px; height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
}
.ll-cap.is-on .ll-cap-dot { border-color: transparent; }
.ll-cap-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ll-cap-go {
  flex-shrink: 0;
  width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--tr), color var(--tr), background var(--tr);
}
.ll-cap:hover .ll-cap-go { opacity: 1; }
.ll-cap-go:hover { color: var(--text-primary); background: var(--bg-hover); }

.ll-verdict {
  color: var(--text-secondary);
  padding: 5px 8px;
  background: var(--bg-card, var(--bg-raised));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.ll-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  transition: border-color var(--tr), background var(--tr);
}
.ll-row:hover { background: var(--bg-hover); border-color: var(--border-active); }
.ll-row.is-on { border-color: rgba(41,121,255,0.28); }

.ll-dot {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  border: 1px solid var(--text-muted);
  background: transparent;
  transition: background var(--tr), border-color var(--tr), box-shadow var(--tr);
}
.ll-dot.is-on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41,121,255,0.16);
}
.ll-dot:hover { border-color: var(--text-secondary); }
.ll-dot.is-on:hover { box-shadow: 0 0 0 4px rgba(41,121,255,0.24); }
.ll-dot:active { transform: scale(0.9); }

.ll-swatch {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.4);
}

.ll-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--tr);
}
.ll-row.is-on .ll-name { color: var(--text-primary); }
.ll-name:hover { color: var(--text-accent); }

.ll-type {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--text-muted);
}
.ll-type.is-warn { color: var(--lt-spot, #f59e0b); }

.ll-solo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color var(--tr), background var(--tr);
}
.ll-solo .icon { width: 12px; height: 12px; display: block; }
.ll-solo:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.ll-solo:active { transform: scale(0.92); }

.ll-rename-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  font-size: 10px;
}
.ll-rename-old {
  flex: 1;
  min-width: 0;
  color: var(--text-muted);
  text-decoration: line-through;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ll-rename-arrow { color: var(--text-muted); flex-shrink: 0; }
.ll-rename-new {
  flex: 1;
  min-width: 0;
  color: var(--text-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════
   Premium Polish — fluid animations & micro-interactions
   ═══════════════════════════════════════════════════════ */

/* ─── Sliding nav indicator ──────────────────────────── */
.nav-indicator {
  position: absolute;
  height: calc(100% - 6px);
  top: 3px;
  border-radius: 8px;
  background: var(--accent-subtle);
  border: 1px solid rgba(41,121,255,0.18);
  box-shadow: 0 0 10px rgba(41,121,255,0.08);
  transition: left var(--dur-md) var(--spring), width var(--dur-md) var(--spring);
  z-index: 0;
  pointer-events: none;
}
/* ─── Page transitions ───────────────────────────────── */
@keyframes lp-pageIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.panel-page.active { animation: lp-pageIn var(--dur-md) var(--spring) both; }

/* ─── Section collapse animation ─────────────────────── */
.section-header.collapsed + .section-body {
  display: flex;
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

/* ─── Staggered reveal ───────────────────────────────── */
@keyframes lp-staggerIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section-body > *:nth-child(1) { animation: lp-staggerIn var(--dur-sm) 0s    var(--spring) both; }
.section-body > *:nth-child(2) { animation: lp-staggerIn var(--dur-sm) 0.03s var(--spring) both; }
.section-body > *:nth-child(3) { animation: lp-staggerIn var(--dur-sm) 0.06s var(--spring) both; }
.section-body > *:nth-child(4) { animation: lp-staggerIn var(--dur-sm) 0.09s var(--spring) both; }
.section-body > *:nth-child(5) { animation: lp-staggerIn var(--dur-sm) 0.12s var(--spring) both; }

/* ─── Premium slider thumb ───────────────────────────── */
input[type="range"]::-webkit-slider-thumb {
  box-shadow: 0 0 8px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.15s var(--spring), box-shadow 0.15s ease;
}
input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 12px var(--accent-glow), 0 2px 8px rgba(0,0,0,0.5);
}

/* ─── Preset thumb polish ────────────────────────────── */
.preset-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.preset-thumb.active {
  box-shadow: 0 0 0 1px var(--accent-glow), 0 0 12px rgba(41,121,255,0.15);
}

/* ─── Audition glow (hover-previewing a different preset) */
.preset-thumb:not(.active):hover {
  box-shadow: 0 0 0 1px rgba(41,121,255,0.35), 0 0 14px rgba(41,121,255,0.18);
}

/* ─── Mode & shape button hover lift ─────────────────── */
.mode-btn:hover, .shape-btn:hover {
  transform: translateY(-1px);
}
.mode-btn.active {
  box-shadow: 0 2px 10px rgba(41,121,255,0.12);
}

/* ─── Light mixer row polish ─────────────────────────── */
.lm-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--int-pct, 0%);
  background: linear-gradient(90deg, rgba(41,121,255,0.05) 0%, transparent 100%);
  border-radius: 6px;
  pointer-events: none;
  transition: width 0.4s ease;
}
.lm-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  background: var(--bg-hover);
  border-color: var(--border);
}

/* Mixer rows must stay visually static during Python-driven refreshes
   (solo/mute/undo). Rebuilds still happen internally, but without the
   staggered "re-listing" animation that made every refresh visible. */
.lm-row { animation: none !important; }

/* ─── Scrim preview border glow — hover combines depth shadow + accent glow ── */
.scrim-preview-box {
  transition: box-shadow 0.3s ease;
}
.scrim-preview-box:hover {
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.55),
              0 0 14px rgba(41,121,255,0.18),
              inset 0 0 10px rgba(41,121,255,0.08);
}

/* Controls that only take effect once their section switch is on */
.section-body.is-inert .ctrl-row {
  opacity: 0.4;
}
.section-body.is-inert input[type="range"] {
  cursor: not-allowed;
}

/* ─── Status dot — single pulse on state change, no infinite loop ──── */
@keyframes lp-status-ring {
  0%   { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2.5); opacity: 0; }
}
.status-dot.ready::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--success);
  animation: lp-status-ring 0.8s ease-out forwards;
}
.status-dot { position: relative; }

/* ─── Footer button — static with hover shimmer ─────────── */
.footer-btn:hover {
  box-shadow: 0 4px 22px var(--accent-glow);
}

/* ─── Toast progress bar ─────────────────────────────── */
@keyframes lp-toast-shrink {
  from { width: 100%; }
  to   { width: 0%; }
}
.toast .toast-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  animation: lp-toast-shrink 2.8s linear forwards;
  pointer-events: none;
}
.toast.toast--paused .toast-bar {
  animation-play-state: paused !important;
  -webkit-animation-play-state: paused !important;
}

/* ─── Action button hover lift ───────────────────────── */
.btn-action:hover {
  transform: translateY(-1px);
}

/* ─── Topbar icon button press ───────────────────────── */
.topbar-icon-btn:active { transform: scale(0.96); }

/* ─── Keyboard focus ring (visible only via Tab, not click) ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input[type="range"]:focus-visible {
  outline-offset: 4px;
}
.nav-btn:focus-visible,
.mode-btn:focus-visible,
.shape-btn:focus-visible {
  outline-offset: -2px;
}
.footer-btn:focus-visible {
  outline-color: #fff;
}

/* ═══════════════════════════════════════════════════
   DOME / HDR PAGE
   ═══════════════════════════════════════════════════ */

.dome-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 11px;
}
.dome-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--tr);
}
.dome-status-dot.linked {
  background: var(--success);
  box-shadow: 0 0 6px rgba(52,211,153,0.4);
}


.dome-hdr-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 4px;
}
.dome-hdr-globe {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  cursor: grab;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 3px 14px rgba(0,0,0,0.55),
    0 0 18px rgba(90,130,255,0.07);
  border: 1px solid rgba(255,255,255,0.06);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.dome-hdr-globe:hover {
  box-shadow:
    0 3px 18px rgba(0,0,0,0.65),
    0 0 24px rgba(90,130,255,0.14);
  border-color: rgba(255,255,255,0.12);
}
.dome-hdr-globe::after {
  content: '\21BB';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.dome-hdr-globe:hover::after {
  opacity: 1;
}
.dome-hdr-globe:active {
  cursor: grabbing;
  box-shadow:
    0 2px 10px rgba(0,0,0,0.5),
    0 0 28px rgba(90,130,255,0.18);
}
.dome-hdr-info {
  flex: 1;
  min-width: 0;
}
.dome-hdr-info .dome-hdr-name {
  font-size: 11px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dome-hdr-meta {
  font-size: 9px;
  color: var(--text-accent);
  margin-top: 2px;
  letter-spacing: 0.3px;
  opacity: 0.8;
}
.dome-hdr-info .dome-hdr-sub {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.3px;
}

/* Dome toggle reuses global .toggle styles */

#page-dome .ctrl-label {
  min-width: 90px;
  flex-shrink: 0;
}

/* Dome sections inherit the same smooth collapse animation as all other pages */

/* ─── HDR Library ────────────────────────────────── */
.hdr-lib-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hdr-lib-folder {
  flex: 1;
  min-width: 0;
  font-size: 9px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.lib-folder-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
}
.lib-folder-btn:hover {
  background: var(--accent);
  color: #fff;
}
.hdr-lib-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}
.hdr-lib-strip::-webkit-scrollbar { height: 4px; }
.hdr-lib-strip::-webkit-scrollbar-track { background: transparent; }
.hdr-lib-strip::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 2px; }
.hdr-lib-empty,
.ies-lib-empty {
  width: 100%;
  text-align: center;
  padding: 16px 8px;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  line-height: 1.5;
}
.hdr-lib-card {
  flex-shrink: 0;
  width: 96px;
  cursor: pointer;
  border-radius: 5px;
  border: 2px solid transparent;
  padding: 2px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.hdr-lib-card:hover {
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.hdr-lib-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(41,121,255,0.3);
}
.hdr-lib-thumb {
  display: block;
  width: 92px;
  height: 46px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--bg-root);
  pointer-events: none;
}
.hdr-lib-star {
  position: absolute;
  top: 1px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  line-height: 0;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
  box-sizing: border-box;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
  transition: color 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.55));
}
.hdr-lib-star .lp-lib-heart {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}
.hdr-lib-star:not(.fav) .lp-lib-heart-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linejoin: round;
}
.hdr-lib-star.fav .lp-lib-heart-path {
  fill: currentColor;
  stroke: none;
}
.hdr-lib-star:hover {
  color: #fff;
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.42);
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
  transform: scale(1.06);
}
.hdr-lib-star.fav {
  color: #ff1744;
  background: rgba(255,80,100,0.2);
  border-color: rgba(255,140,155,0.55);
  box-shadow: 0 0 0 1px rgba(255,60,90,0.12), 0 2px 8px rgba(255,23,68,0.22);
  filter: drop-shadow(0 0 2px rgba(255,23,68,0.35));
}
.hdr-lib-star.fav:hover {
  background: rgba(255,100,120,0.28);
  border-color: rgba(255,170,180,0.65);
}
.hdr-lib-name {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* ═══════════════════════════════════════════════════
   IES LIBRARY (mirrors HDR Library)
   ═══════════════════════════════════════════════════ */

.ies-active-name {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ies-active-name.has-profile {
  color: var(--text-accent);
}
.ies-fwhm {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-accent);
  white-space: nowrap;
}
.ies-lib-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ies-lib-folder {
  flex: 1;
  min-width: 0;
  font-size: 9px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.ies-lib-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}
.ies-lib-strip::-webkit-scrollbar { height: 4px; }
.ies-lib-strip::-webkit-scrollbar-track { background: transparent; }
.ies-lib-strip::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 2px; }
.ies-lib-card {
  flex-shrink: 0;
  width: 68px;
  cursor: pointer;
  border-radius: 5px;
  border: 2px solid transparent;
  padding: 2px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ies-lib-card:hover {
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.ies-lib-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(41,121,255,0.3);
}
.ies-lib-thumb {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--bg-root);
  pointer-events: none;
}
.ies-lib-star {
  position: absolute;
  top: 1px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
  box-sizing: border-box;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
  transition: color 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.55));
}
.ies-lib-star .lp-lib-heart {
  width: 12px;
  height: 12px;
  display: block;
  pointer-events: none;
}
.ies-lib-star:not(.fav) .lp-lib-heart-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linejoin: round;
}
.ies-lib-star.fav .lp-lib-heart-path {
  fill: currentColor;
  stroke: none;
}
.ies-lib-star:hover {
  color: #fff;
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.42);
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
  transform: scale(1.06);
}
.ies-lib-star.fav {
  color: #ff1744;
  background: rgba(255,80,100,0.2);
  border-color: rgba(255,140,155,0.55);
  box-shadow: 0 0 0 1px rgba(255,60,90,0.12), 0 2px 8px rgba(255,23,68,0.22);
  filter: drop-shadow(0 0 2px rgba(255,23,68,0.35));
}
.ies-lib-star.fav:hover {
  background: rgba(255,100,120,0.28);
  border-color: rgba(255,170,180,0.65);
}
.ies-lib-name {
  display: block;
  margin-top: 3px;
  font-size: 7px;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* IES status (mirrors dome-status) */
.ies-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.ies-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.ies-status-dot.linked {
  background: var(--success);
  box-shadow: 0 0 5px rgba(52,211,153,0.45);
}
.ies-status-text {
  font-size: 10px;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════
   v38 — P1 motion accessibility + focus (panel)
   ═══════════════════════════════════════════════════════ */

button:focus-visible,
.nav-btn:focus-visible,
.topbar-icon-btn:focus-visible,
.footer-btn:focus-visible,
.btn-action:focus-visible,
.btn-sm:focus-visible,
.lib-folder-btn:focus-visible,
.preset-thumb:focus-visible,
input[type="range"]:focus-visible,
.color-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lp-reduce-motion .panel-page.active,
.lp-low-perf .panel-page.active {
  animation: none !important;
}

.lp-reduce-motion .section-body > *,
.lp-low-perf .section-body > * {
  animation: none !important;
}

.lp-reduce-motion .status-dot.busy,
.lp-low-perf .status-dot.busy {
  animation: none !important;
}

.lp-reduce-motion .status-dot.idle,
.lp-low-perf .status-dot.idle {
  animation: none !important;
}

.lp-reduce-motion .lm-row--landed,
.lp-low-perf .lm-row--landed {
  animation: none !important;
}

.lp-reduce-motion .app,
.lp-low-perf .app {
  transition: none !important;
}

.lp-reduce-motion .nav-indicator,
.lp-low-perf .nav-indicator {
  transition: none !important;
}

.lp-reduce-motion .preset-thumb:hover,
.lp-low-perf .preset-thumb:hover {
  transform: none !important;
}


@media (prefers-reduced-motion: reduce) {
  .panel-page.active { animation: none !important; }
  .section-body > * { animation: none !important; }
  .status-dot.busy,
  .status-dot.idle { animation: none !important; }
  .lm-row--landed { animation: none !important; }
  .app { transition: none !important; }
  .nav-indicator { transition: none !important; }
  .preset-thumb:hover { transform: none !important; }
}
/* ── Curve scrim (shape #4) ──────────────────────────────────────────────────
   Only additive rules: the three existing scrim shapes are untouched. Elements
   tagged `.sc-curve-only` are hidden until the Curve shape is selected, and
   `.sc-pen-only` / `.sc-brush-only` split on the active tool. */

.curve-tools {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.curve-tools-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted, #5b5b66);
}
.curve-tools-sep {
  width: 1px; height: 16px; background: var(--border, #3a3a3d); margin: 0 3px;
}
.curve-stroke-list { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.cv-stroke-chip {
  padding: 2px; width: 44px; height: 30px; box-sizing: border-box;
  border: 1px solid var(--border, #3a3a3d); border-radius: 5px;
  background: #121218; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: stretch; flex-shrink: 0;
  overflow: hidden;
}
.cv-stroke-chip:hover { border-color: #5a5a66; }
.cv-stroke-chip.is-active {
  border-color: #3da9fc;
  box-shadow: 0 0 0 1px rgba(61,169,252,.55);
}
.cv-stroke-chip-cv { width: 100%; height: 100%; display: block; border-radius: 3px; }
#btn-curve-xform-all.is-on {
  color: #3da9fc; border-color: #3da9fc;
}
.curve-draw-state {
  font-size: 10.5px; font-family: ui-monospace, monospace;
  color: var(--lt-key, #4ade80);
}
.curve-draw-state.is-idle { color: var(--text-muted, #71717a); }

/* Per-point colour swatches: the index sits on the swatch, so the list needs no
   labels and stays readable at panel width. */
.cv-swatch-list { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; flex: 1; }
.cv-swatch-wrap { position: relative; display: inline-flex; }
.cv-swatch-idx {
  position: absolute; right: -2px; bottom: -1px; pointer-events: none;
  font-family: ui-monospace, monospace; font-size: 8px; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}
/* A ring means "this point is a colour stop"; dimmed means it inherits Core. */
.ctrl-color.is-stop { border: 2px solid #fff; }
.ctrl-color.is-inherit { opacity: .45; }

/* Locked master sliders read as unavailable without collapsing the layout. */
#sl-cv-feaL:disabled, #sl-cv-feaR:disabled { opacity: .38; pointer-events: none; }

/* Curve editor stage: same square hero footprint as the scrim preview, so
   switching shapes does not reflow the page. */
.cv-stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: #000; border: 1px solid var(--border-subtle, #2a2a30);
  border-radius: 8px; overflow: hidden;
}
.cv-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#cv-overlay { cursor: crosshair; }
.cv-fps {
  position: absolute; left: 8px; bottom: 6px; pointer-events: none;
  font-family: ui-monospace, monospace; font-size: 9.5px; color: #fbbf24;
  opacity: .75;
}
#cv-fall-prev {
  border: 1px solid var(--border-subtle, #232327); border-radius: 4px;
  background: #0b0b0e;
}

/* ── Curve: make `hidden` actually hide ─────────────────────────────────────
   Both of these override the default [hidden] rule, which is why the radial
   scrim disc stayed on screen behind the curve canvas and why every curve
   section was visible at once:
     · .scrim-preview-box sets `display:flex`
     · .section sets `display:flex`
   The UA sheet's `[hidden]{display:none}` loses to any class rule with a
   display, so the attribute needs explicit help — the same reason
   `.stage-section[hidden]` already exists further up this file. */
.scrim-preview-box[hidden],
.section[hidden],
.ctrl-row[hidden],
.cv-stage[hidden],
.stage-band[hidden] { display: none !important; }

/* ── Curve colour: gradient bar + positioned stops ───────────────────────────
   A gradient is easier to read as a gradient than as a row of swatches: the bar
   previews the real along-curve blend, and each chip sits at its point's arc
   position, so order and spacing are visible at a glance. */
.cv-grad { position: relative; margin: 2px 0 12px; }
.cv-grad-bar {
  height: 22px; border-radius: 5px;
  border: 1px solid var(--border-subtle, rgba(255,255,255,.07));
  /* checkerboard shows through where the stroke has no colour yet */
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.10), rgba(255,255,255,.10)),
    linear-gradient(45deg, #1a1a1f 25%, transparent 25%, transparent 75%, #1a1a1f 75%),
    linear-gradient(45deg, #1a1a1f 25%, transparent 25%, transparent 75%, #1a1a1f 75%);
  background-size: 100% 100%, 8px 8px, 8px 8px;
  background-position: 0 0, 0 0, 4px 4px;
}
.cv-grad-stops { position: relative; height: 14px; }
.cv-stop {
  position: absolute; top: 0; transform: translateX(-50%);
  width: 12px; height: 12px; padding: 0; cursor: pointer;
  border-radius: 3px; border: 1px solid rgba(0,0,0,.65);
  box-shadow: 0 0 0 1px rgba(255,255,255,.22);
}
/* An unset point is a hollow marker: present on the curve, not a colour stop. */
.cv-stop.is-empty {
  background: transparent !important;
  border: 1px dashed rgba(255,255,255,.35);
  box-shadow: none;
}
.cv-stop.is-sel { box-shadow: 0 0 0 2px var(--accent); z-index: 2; }
.cv-stop::after {                      /* little stem pointing at the bar */
  content: ''; position: absolute; left: 50%; top: -4px;
  width: 1px; height: 4px; background: rgba(255,255,255,.35);
  transform: translateX(-50%);
}
.cv-grad-foot {
  display: flex; align-items: center; gap: 8px; margin: -6px 0 2px;
}
.cv-grad-hint {
  flex: 1; font-size: 10px; line-height: 1.4;
  color: var(--text-muted, #5b5b66);
}
.cv-div {
  height: 1px; margin: 4px 0 2px;
  background: var(--border-subtle, rgba(255,255,255,.06));
}
/* Core / Edge dim out while per-point colours are driving the stroke, so the
   panel shows which control is actually in charge. */
#row-cv-coreedge.is-super { opacity: .4; }


/* Destructive action in the stroke strip reads as destructive. */
.curve-tools .btn-sm.is-danger { color: #f87171; border-color: rgba(248,113,113,.35); }
.curve-tools .btn-sm.is-danger:hover { background: rgba(248,113,113,.12); }

/* ─── Scrim blend modes (curve strokes + layers) ─── */
.blend-seg { display: flex; gap: 4px; flex: 1; }
.blend-seg .btn-sm { flex: 1; padding: 5px 0; font-size: 10px; }
.cv-stroke-chip { position: relative; }
.cv-mode-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 4px; font-size: 9px; font-weight: 600; line-height: 14px;
  text-align: center; color: #e6e6eb; background: rgba(255,255,255,.14);
  pointer-events: none;
}
.cv-stroke-chip.is-subtract .cv-mode-badge { background: rgba(248,113,113,.28); color: #fca5a5; }
.cv-stroke-chip.is-multiply .cv-mode-badge { background: rgba(96,165,250,.28); color: #93c5fd; }
.cv-stroke-chip.is-subtract { border-color: rgba(248,113,113,.55); }
.cv-stroke-chip.is-multiply { border-color: rgba(96,165,250,.55); }

/* ─── Scrim layers ─── */
.sc-layer-chips { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.sc-layer-chip {
  position: relative; min-width: 44px; height: 24px; padding: 0 8px;
  border-radius: 6px; border: 1px solid var(--border, #2a2a33);
  background: var(--bg-input, #17171c); color: var(--text-dim, #9a9aa5);
  font-size: 10px; cursor: pointer;
}
.sc-layer-chip.is-active { border-color: var(--accent, #4f8cff); color: var(--text, #e6e6eb); }
.sc-layer-chip.is-subtract { border-color: rgba(248,113,113,.55); }
.sc-layer-chip.is-multiply { border-color: rgba(96,165,250,.55); }

/* Green add / red delete affordances + layer stack controls */
.btn-sm.is-add { color: #4ade80; border-color: rgba(74, 222, 128, 0.45); font-weight: 700; }
.btn-sm.is-add:hover { background: rgba(74, 222, 128, 0.14); border-color: rgba(74, 222, 128, 0.8); }
.btn-sm.is-del { color: #f87171; border-color: rgba(248, 113, 113, 0.45); font-weight: 700; }
.btn-sm.is-del:hover { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.8); }
.sc-add-wrap { position: relative; display: inline-flex; justify-content: flex-end; }
.sc-layer-add {
  appearance: none; -webkit-appearance: none;
  background: rgba(74, 222, 128, 0.07); color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.4); border-radius: 6px;
  font-size: 11px; font-weight: 700; padding: 5px 10px; cursor: pointer;
  white-space: nowrap;
}
.sc-layer-add:hover,
.sc-layer-add[aria-expanded="true"] { background: rgba(74, 222, 128, 0.16); border-color: rgba(74, 222, 128, 0.8); }
.sc-add-menu {
  position: fixed; z-index: 220;
  width: 168px;
  padding: 4px;
  background: #1a1a1e;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.45);
}
.sc-add-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 5px 6px;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.sc-add-item:hover { background: var(--bg-hover); }
.sc-add-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sc-add-copy strong { font-size: 11px; font-weight: 600; line-height: 1.2; }
.sc-add-copy em { font-size: 10px; font-style: normal; color: var(--text-secondary); line-height: 1.2; }
.sc-add-mini {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: 5px;
  background: #0c0c10;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.sc-add-mini--disc { background: radial-gradient(circle at 50% 50%, #f2f2f4 12%, rgba(242,242,244,0) 70%), #0c0c10; }
.sc-add-mini--box {
  background: linear-gradient(#0c0c10, #0c0c10) padding-box, linear-gradient(#d8d8dc, #d8d8dc) border-box;
  border: 2px solid transparent; border-radius: 6px;
}
.sc-add-mini--ring { background: radial-gradient(circle, transparent 38%, #e8e8ea 40%, #e8e8ea 52%, transparent 54%), #0c0c10; }
.sc-add-mini--frame {
  background: linear-gradient(#0c0c10, #0c0c10) padding-box, linear-gradient(#e8e8ea, #e8e8ea) border-box;
  border: 2px solid transparent;
}
.sc-add-mini--h { background: linear-gradient(#0c0c10, #e8e8ea 50%, #0c0c10); }
.sc-add-mini--v { background: linear-gradient(90deg, #0c0c10, #e8e8ea 50%, #0c0c10); }
.sc-layer-eye { cursor: pointer; margin-right: 4px; opacity: 0.9; font-size: 10px; }
.sc-layer-eye.is-off { opacity: 0.35; }
.sc-layer-chip.is-hidden { opacity: 0.45; }
.sc-layer-chip.is-screen { border-color: rgba(96, 165, 250, 0.6); }

/* ─── Link Deck (Linking page) ─────────────────────────────────────────── */

.ld-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ld-head .spacer { flex: 1; }
.ld-total { margin-left: auto; color: var(--text-muted); font-size: 10px; }
.ld-browser-tools { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.ld-browser-tools .ctrl-select { flex: 1; min-width: 0; }
.ld-results { color: var(--text-muted); font-size: 10px; padding: 2px 0 8px; }
.ld-browser-list { max-height: min(360px, 50vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.ld-light-group { border-bottom: 1px solid var(--border); }
.ld-group-head { display: flex; align-items: center; gap: 6px; padding: 9px 2px; cursor: pointer; list-style: none; font-size: 11px; color: var(--text-secondary, var(--text)); }
.ld-group-head::-webkit-details-marker { display: none; }
.ld-group-head::before { content: '›'; width: 10px; color: var(--text-muted); }
.ld-light-group[open] > .ld-group-head::before { transform: rotate(90deg); }
.ld-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-group-count { margin-left: auto; color: var(--text-muted); font-size: 10px; }
.ld-group-body { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.ld-light-row { display: flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 5px; }
.ld-light-row:hover, .ld-light-row:focus-within { background: var(--bg-panel); }
.ld-light-row.is-muted { opacity: .55; }
.ld-light-open { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; min-height: 30px; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; font: inherit; padding: 3px 0; }
.ld-light-open .ld-name { font-size: 11px; font-weight: 400; min-width: 0; }
.ld-light-row .ld-mini { display: flex; gap: 3px; flex: none; }
.ld-light-row .ld-mini button:disabled { opacity: .3; cursor: default; }
.ld-group-body .ld-lrow { border-color: transparent; border-radius: 5px; background: none; min-width: 0; }
.ld-group-body .ld-lrow .ld-lstate { max-width: 35%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sec-ld-browser .ld-head { flex-wrap: wrap; }
#sec-ld-browser .ld-search { flex: 1 1 120px; min-width: 80px; }
.ld-title { font-size: 12px; font-weight: 600; color: var(--text); }
.ld-clip { font-size: 10px; color: var(--text-muted); display: none; align-items: center; gap: 4px; }
.ld-clip.on { display: inline-flex; }
.ld-clip .icon { color: var(--text-muted); }
.ld-search { flex: 0 1 150px; min-width: 90px; font-size: 11px; padding: 4px 8px; }
.ld-refresh { padding: 4px 6px; }

.ld-viewseg { display: flex; background: var(--bg-root, #0a0a0d); border: 1px solid var(--border); border-radius: 8px; padding: 2px; margin-bottom: 10px; }
.ld-viewseg button { flex: 1; padding: 5px 0; border: none; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 500; border-radius: 6px; cursor: pointer; font-family: inherit; }
.ld-viewseg button.on { background: #26262e; color: var(--text); }

/* Grid of light cards */
.ld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ld-card { position: relative; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 10px 8px; cursor: pointer; text-align: left; font-family: inherit; color: var(--text); transition: border-color 120ms ease; }
.ld-card:hover { border-color: var(--border-active); }
.ld-card.is-muted { opacity: 0.55; }
.ld-card-top { display: flex; align-items: center; gap: 7px; }
.ld-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ld-dot.hollow { background: transparent !important; border: 1.5px solid var(--text-muted); }
.ld-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-mode { margin-left: auto; font-size: 9px; color: var(--text-muted); border: 1px solid var(--border); padding: 1px 6px; border-radius: 99px; flex: none; }
.ld-sub { margin-top: 5px; font-size: 10px; color: var(--text-muted); }
.ld-card .ld-mini { position: absolute; top: 6px; right: 6px; display: none; gap: 3px; }
.ld-card:hover .ld-mini { display: flex; }
.ld-card:hover .ld-mode { opacity: 0; }
.ld-mini button { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--border); background: var(--bg-root, #0a0a0d); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.ld-mini button:hover { color: var(--text); border-color: var(--border-active); }
.ld-mini button.is-armed { color: #7ee2a8; border-color: rgba(126, 226, 168, 0.45); }

/* Detail view */
.ld-back { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; padding: 0 0 8px; font-family: inherit; }
.ld-back:hover { color: var(--text); }
.ld-dhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ld-dname { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.ld-dhead .ld-mini { position: static; display: flex; gap: 3px; }
.ld-mseg { display: flex; background: var(--bg-root, #0a0a0d); border: 1px solid var(--border); border-radius: 6px; padding: 1px; margin-left: auto; }
.ld-mseg button { padding: 3px 9px; border: none; background: transparent; color: var(--text-muted); font-size: 10px; border-radius: 5px; cursor: pointer; font-family: inherit; }
.ld-mseg button.on { background: #26262e; color: var(--text); }

.ld-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.ld-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg-panel); border: 1px solid var(--border); font-size: 11px; }
.ld-row .ld-rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-row .ld-rsub { font-size: 9px; color: var(--text-muted); flex: none; }
.ld-row .ld-rx { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; border-radius: 4px; display: flex; flex: none; }
.ld-row .ld-rx:hover { color: var(--text); }
.ld-row.is-exc { border-style: dashed; }
/* List colour describes Include/Exclude; flags and the dashed border
   continue to describe exceptions within that list. */
.ld-row.link-tone-include .ld-rname { color: var(--link-include); }
.ld-row.link-tone-exclude .ld-rname { color: var(--link-exclude); }
.ld-exc-tag { font-size: 9px; color: var(--text-muted); font-style: italic; flex: none; }

.ld-flags { display: flex; gap: 2px; flex: none; }
.ld-flags .ll-flag-toggle { width: 18px; height: 18px; }

.ld-sect { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 10px 0 6px; }
.ld-addbar { display: flex; gap: 5px; margin-bottom: 6px; align-items: center; }
.ld-addbar .ctrl-select { flex: 1; min-width: 0; font-size: 11px; }
.ld-crumbs { display: flex; align-items: center; gap: 2px; font-size: 10px; color: var(--text-muted); margin-bottom: 6px; flex-wrap: wrap; }
.ld-crumbs button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 10px; padding: 0; font-family: inherit; }
.ld-crumbs button:hover { text-decoration: underline; }
.ld-crumbs .ld-crumb-sep { color: var(--text-muted); }

.ld-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.ld-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text); font-size: 11px; cursor: pointer; text-align: left; font-family: inherit; width: 100%; }
.ld-item:hover { background: var(--bg-hover); border-color: var(--border); }
.ld-item .ld-iname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-item .ld-isub { margin-left: auto; font-size: 9px; color: var(--text-muted); flex: none; }
.ld-item .ld-ichev { margin-left: auto; color: var(--text-muted); flex: none; display: flex; }
.ld-item .ld-ichev svg { display: block; }

/* Toggle circle (shared by add-list rows and search hits) */
.ld-t { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border-active); flex: none; position: relative; }
.ld-t.on { background: var(--accent); border-color: var(--accent); }
.ld-t.inh { border-color: var(--accent); }
.ld-t.inh::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); opacity: 0.55; }
.ld-t.off { border-color: #b05656; }
.ld-t.off::after { content: ""; position: absolute; left: 2px; right: 2px; top: 50%; height: 1.5px; margin-top: -0.75px; background: #b05656; }
.ld-t.offin { border-color: #b05656; opacity: 0.6; }
.ld-t.offin::after { content: ""; position: absolute; left: 2px; right: 2px; top: 50%; height: 1.5px; margin-top: -0.75px; background: #b05656; }
.ld-t.exc { border-color: var(--warning); border-style: dashed; }

.ld-note { font-size: 10px; color: var(--text-muted); line-height: 1.5; margin: 0 0 8px; }
.ld-hint { font-size: 10px; color: var(--text-muted); padding: 4px 2px; }

/* Search hits dropdown */
.ld-hits { position: relative; display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.ld-hit { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; background: var(--bg-panel); border: 1px solid var(--border); font-size: 11px; cursor: pointer; text-align: left; color: var(--text); font-family: inherit; width: 100%; }
.ld-hit:hover { border-color: var(--border-active); }
.ld-hit .ld-hpath { font-size: 9px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* By Object rows */
.ld-objhead { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; flex-wrap: wrap; }
.ld-objname { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-objcnt { font-size: 10px; color: var(--text-muted); }
.ld-pin { background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); cursor: pointer; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.ld-pin.on { color: var(--accent); border-color: var(--accent); }
.ld-lrow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg-panel); border: 1px solid var(--border); font-size: 11px; cursor: pointer; }
.ld-lrow:hover { border-color: var(--border-active); }
.ld-lrow .ld-lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-lrow .ld-lstate { margin-left: auto; font-size: 9px; color: var(--text-muted); flex: none; }
.ld-lrow .ld-lgo { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; display: flex; flex: none; }
.ld-lrow .ld-lgo:hover { color: var(--text); }
.ld-lrow.is-off { opacity: 0.6; }

/* Transfer / rename live in collapsible sections under the deck (no modal:
   an overlay sheet over the grid read as a menu stacked on a menu). */
#page-linking { position: relative; }

/* Legacy readouts remain sync targets but never take layout space. */
.slider-val[hidden], #cvp-opacity-value[hidden] { display: none !important; }
input.slider-val:disabled { opacity: .45; cursor: default; }

.lp-color-wheel__numbers { display: flex; gap: 8px; width: 196px; }
.lp-color-wheel__numbers label { min-width: 0; flex: 1; font-size: 10px; color: var(--text-secondary); }
.lp-color-wheel__numbers input.slider-val { display: block; width: 100%; min-width: 0; margin-top: 3px; }

/* Native update download status, inside Setup / About. */
.update-download { margin: 6px 0 0; font-size: 11px; color: var(--text-secondary); }
.update-download[hidden], .update-download [hidden] { display: none; }
.update-download p { margin: 0 0 2px; }
.update-progress { display: block; width: 100%; height: 6px; margin: 8px 0; overflow: hidden; border-radius: 3px; background: #292d35; }
.update-progress-fill { display: block; width: var(--download-progress, 0%); height: 100%; border-radius: inherit; background: #69a6ff; transition: width 140ms cubic-bezier(.2,0,0,1); }
.update-progress.is-indeterminate .update-progress-fill { width: 35%; transition: none; animation: update-download-pulse 1200ms cubic-bezier(.4,0,.2,1) infinite; }
@keyframes update-download-pulse { from { transform: translateX(-110%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .update-progress-fill { transition: none; } .update-progress.is-indeterminate .update-progress-fill { animation: none; transform: translateX(90%); } }
.update-download-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#update-download-path { overflow-wrap: anywhere; user-select: text; }

/* Persistent cleanup status beside the maintenance actions. */
.cleanup-status { margin-top: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-secondary); }
/* A newly unhidden status must not wait through the section's stagger fade. */
.section-body > .cleanup-status { animation: none; }
.cleanup-status[hidden], .cleanup-status [hidden] { display: none; }
.cleanup-status p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.cleanup-status-heading { font-size: 10px; font-weight: 600; color: var(--text-muted); }
.cleanup-status-message { margin-top: 2px !important; font-size: 11px; }
.cleanup-status-detail { margin-top: 5px !important; font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cleanup-status progress { display: block; width: 100%; height: 4px; margin-top: 7px; accent-color: var(--accent); }
.cleanup-status[data-state="paused"] progress { opacity: .45; }

/* Paint page: Paint / Scene tabs on the right panel. */
.panel-tabs { display: flex; gap: 3px; padding: 2px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; }
.panel-tab { flex: 1; min-width: 0; padding: 6px 0; border: none; border-radius: 6px; background: transparent; color: var(--text-secondary); font-family: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; transition: background var(--tr), color var(--tr); }
.panel-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.panel-tab.on { background: var(--bg-raised); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--accent); }
.panel-tab:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
#page-paint[data-ptab-active="paint"] > .section[data-ptab="scene"],
#page-paint[data-ptab-active="scene"] > .section[data-ptab="paint"] { display: none; }

/* Segmented choice (Mirror axis / result). */
.lp-seg { display: flex; flex: 1; min-width: 0; max-width: 210px; gap: 2px; padding: 2px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 7px; }
.lp-seg button { flex: 1; min-width: 0; padding: 4px 2px; border: none; border-radius: 5px; background: transparent; color: var(--text-secondary); font-family: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background var(--tr), color var(--tr); }
.lp-seg button:hover { color: var(--text-primary); }
.lp-seg button.on { background: var(--accent-subtle); color: var(--text-primary); box-shadow: inset 0 0 0 1px rgba(41,121,255,0.55); }

/* Mirror & Radial: one tool at a time, each with a single outlined action so
   the section does not outshout the paint controls above it. */
.mr-tabs { display: flex; gap: 3px; padding: 2px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; }
.mr-tab { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 0; border: none; border-radius: 6px; background: transparent; color: var(--text-secondary); font-family: inherit; font-size: 10.5px; font-weight: 600; line-height: 1; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; transition: background var(--tr), color var(--tr); }
.mr-tab svg { flex: 0 0 auto; opacity: 0.7; }
.mr-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.mr-tab.on { background: var(--bg-raised); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--accent); }
.mr-tab.on svg { opacity: 1; color: var(--text-accent, #5ea3ff); }
.mr-tab:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.mr-pane { display: flex; flex-direction: column; gap: 6px; }
.mr-group { display: flex; flex-direction: column; gap: 6px; }
.mr-go { width: 100%; height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; border: 1px solid rgba(41, 121, 255, 0.42); background: rgba(41, 121, 255, 0.07); color: var(--text-accent, #5ea3ff); font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; transition: background var(--tr), border-color var(--tr), color var(--tr); }
.mr-go:hover { background: rgba(41, 121, 255, 0.15); border-color: var(--accent); }
.mr-go:active { transform: scale(0.98); }
.mr-go:disabled { border-color: var(--border-active); background: transparent; color: var(--text-muted); cursor: default; transform: none; }
.mr-go-sub { font-weight: 400; opacity: 0.75; }
.mr-card { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-raised); }
.mr-card-head { display: flex; align-items: center; gap: 6px; min-height: 22px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.mr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.mr-card-head .lp-seg { margin-left: auto; flex: 0 1 auto; }
.mr-state { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle, rgba(255,255,255,0.04)); background: var(--bg-panel); font-size: 10px; color: var(--text-muted); }
.mr-state > i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--text-muted); transition: background-color var(--tr), box-shadow var(--tr); }
.mr-state > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-state.is-on { color: var(--text-accent, #5ea3ff); }
.mr-state.is-on > i { background: var(--accent); box-shadow: 0 0 7px rgba(41, 121, 255, 0.75); }
.mr-hint { margin: 0; padding: 0 2px; font-size: 10px; line-height: 1.45; color: var(--text-muted); }
.mr-empty { padding: 7px 8px; border: 1px dashed var(--border-active); border-radius: 7px; font-size: 10px; line-height: 1.45; color: var(--text-muted); }
.mr-foot { margin: 0; padding: 0 2px 2px; font-size: 9.5px; line-height: 1.45; color: var(--text-muted); }
/* Before a rig exists Radial shows Create; on a rig the Ring group becomes a card. */
.mirror-radial:not(.is-live) .radial-live { display: none; }
.mirror-radial.is-live .radial-create { display: none; }
.mirror-radial.is-live .mr-group { gap: 4px; padding: 6px 8px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-raised); }
.mr-pane[hidden], .mr-card[hidden], .mr-empty[hidden] { display: none; }
.lp-seg.radial-members { flex-wrap: wrap; max-width: none; }
.lp-seg.radial-members button { flex: 0 0 auto; min-width: 24px; padding: 4px 6px; }

/* Dark dropdown over a native <select>: the OS popup ignores CSS on Windows. */
.lp-dd { position: relative; display: flex; flex: 1; min-width: 0; max-width: 100%; }
.lp-dd > select.lp-dd-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.lp-dd-btn { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; padding: 5px 8px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-family: inherit; font-size: 11px; font-weight: 500; text-align: left; cursor: pointer; transition: border-color var(--tr); }
.pv-comfort .lp-dd-btn { min-height: 27px; font-size: 11px; }
.lp-dd-btn:hover { border-color: var(--border-active); }
.lp-dd-btn:focus-visible, .lp-dd.open .lp-dd-btn { outline: none; border-color: var(--accent); }
.lp-dd-btn:disabled { opacity: 0.45; cursor: default; }
.lp-dd-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-dd-caret { flex-shrink: 0; width: 8px; height: 5px; color: var(--text-muted); transition: transform var(--tr); }
.lp-dd.open .lp-dd-caret { transform: rotate(180deg); color: var(--text-accent); }
.lp-dd-menu { position: fixed; z-index: 10000; max-height: 260px; overflow-y: auto; padding: 3px; background: #18181c; border: 1px solid var(--border-active); border-radius: 7px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.lp-dd-menu[hidden] { display: none; }
.lp-dd-item { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 5px; font-size: 11px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.lp-dd-item::before { content: ''; flex-shrink: 0; width: 10px; font-size: 10px; color: var(--text-accent); }
.lp-dd-item.sel { color: var(--text-primary); }
.lp-dd-item.sel::before { content: '\2713'; }
.lp-dd-item.hot { background: var(--accent-subtle); color: var(--text-primary); }
.lp-dd-item.is-disabled { opacity: 0.4; cursor: default; }
/* Flat Rim switch: confirmed host state, with a sliding circular thumb. */
.rim-lock-switch { display: inline-flex; align-items: center; padding: 0; border: 0; background: transparent; cursor: pointer; flex-shrink: 0; }
.rim-lock-track { position: relative; display: block; box-sizing: border-box; width: 32px; height: 17px; border: 1px solid transparent; border-radius: 999px; background: #484c55; transition: background-color 160ms cubic-bezier(.2,0,0,1); }
.rim-lock-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #e4e7ec; transition: transform 160ms cubic-bezier(.2,0,0,1), background-color 160ms cubic-bezier(.2,0,0,1); }
.rim-lock-switch.on .rim-lock-track { background: var(--accent, #3977ef); }
.rim-lock-switch.on .rim-lock-track::after { transform: translateX(15px); background: #fff; }
.rim-lock-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
.rim-lock-switch:disabled { opacity: .4; cursor: default; }
@media (prefers-reduced-motion: reduce) { .rim-lock-track, .rim-lock-track::after { transition: none; } }

/* Temporarily parked scene creation controls: hidden also overrides flex. */
#scene-create-controls[hidden], #sec-paint-scene[hidden] { display: none !important; }
.ld-mode.link-tone-include, .ld-mseg button.link-tone-include { color: var(--link-include); }
.ld-mode.link-tone-exclude, .ld-mseg button.link-tone-exclude { color: var(--link-exclude); }
.ld-mseg button.link-tone-include.on { background: rgba(var(--link-include-rgb),0.14); }
.ld-mseg button.link-tone-exclude.on { background: rgba(var(--link-exclude-rgb),0.14); }

/* Native color chooser, with compact access to Kelvin/quick controls. */
.lm-color-options { width: 12px; padding: 0; border: 0; background: transparent;
  color: var(--text-muted, #92959b); cursor: pointer; font-size: 11px; }
.lm-color-options:hover { color: var(--text, #e5e5e5); }

/* P-78 compact Mirror controls; native hidden beats flex layout. */
#mirror-axis-row[hidden], #mirror-camera-center[hidden], #mirror-pivot-option[hidden], #radial-pivot-row[hidden] { display: none; }
/* P-88 one picked Mirror reference instead of a list of every scene object. */
/* Pick is neutral like Add selected; only an armed Pick is accent-filled. */
.mr-ref { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; }
.mr-ref .lm-link-btn { flex: 1; justify-content: center; }
#btn-mirror-ref-pick.on { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 8px var(--accent-glow); }
.mr-ref-picked { display: flex; align-items: center; gap: 4px; min-width: 0; margin: -2px 0 2px 68px; padding: 3px 4px 3px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-raised); }
.mr-ref-picked[hidden], #mirror-ref-row[hidden] { display: none; }
.mr-ref-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 600; color: var(--text-primary); }
.mr-ref-x { flex: 0 0 auto; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-muted); cursor: pointer; }
.mr-ref-x:hover { background: var(--bg-hover); color: var(--text-primary); }
.mirror-options { margin: 4px 0 8px; }
#mirror-link-status { margin: 0 0 4px; min-width: 0; white-space: normal; font-size: 11px; color: var(--text-muted); line-height: 1.4; }
#mirror-link-status.is-linked { color: var(--text-accent); }
.mirror-pair-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 3px 0; }
#mirror-adjust .ctrl-row { display: grid; grid-template-columns: 62px minmax(0, 1fr) 20px; gap: 7px; }
#mirror-adjust .ctrl-label { min-width: 0; white-space: normal; }
#mirror-adjust .slider-wrap { min-width: 0; gap: 7px; }
#mirror-adjust input[type="range"] { min-width: 0; width: 0; flex: 1 1 0; }
#mirror-adjust input.slider-val { min-width: 0; width: 50px; flex: 0 0 50px; }
#mirror-adjust .pv-reset { min-width: 0; width: 20px; }
#btn-mirror-link { flex: 0 0 auto; }
.mirror-options > summary { cursor: pointer; color: var(--text-muted); font-size: 10px; padding: 5px 0; }
/* P-79 top-edge resize. Globe flexes into the remaining space. */
#hdr-library { position: relative; flex-shrink: 0; }
#hdr-library .hdr-lib-strip { height: var(--hdr-library-height, 190px); max-height: var(--hdr-library-height, 190px); box-sizing: border-box; }
#hdr-library-resize { height: 10px; margin-top: -5px; cursor: ns-resize; touch-action: none; display:flex; align-items:center; justify-content:center; }
#hdr-library-resize::after { content: ""; width: 36px; height: 3px; border-radius: 3px; background: var(--border); }
#hdr-library-resize:hover::after, #hdr-library-resize:focus-visible::after { background: #4f8cff; }

/* Preview Solo uses the Mixer's star and active colour, opposite Guides. */
.sc-solo-star { left: 6px; right: auto; color: var(--text-secondary); }
.sc-solo-star:hover { color: #f59e0b; border-color: #f59e0b; }
.sc-solo-star.on { background: #f59e0b; border-color: #f59e0b; color: #000; opacity: 1; }
.sc-solo-star:disabled { opacity: .45; cursor: default; }
.sc-solo-star:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
