/* Keep presentation panels hidden unless their scene explicitly owns input. */
html body #scene-controls,
html body #orb-effects-controls,
html body #firefly-batch-controls,
html body #scroll-speed-panel,
html body #scene5-controls,
html body #scene5-left-controls-column,
html body #scene5-shape006-controls,
html body #scene5-light-controls,
html body #scene5-added-light-controls,
html body #scene5-waypoint-controls,
html body #scene5-glass-controls,
html body #scene5-glass-toggle,
html body #scene5-waypoint-recorder,
html body #waypoints,
html body #scene-light-controls,
html body .tp-dfwv,
html body .tp-rotv,
html body .lil-gui {
  display: none !important;
}

html[data-active-scene="scene5"] body.scene5-glass-controls-visible #scene5-glass-controls:not([hidden]),
html[data-active-scene="scene5"] body.scene5-glass-controls-visible #scene5-glass-controls:not([hidden]) .tp-rotv,
html[data-active-scene="scene5"] body.scene5-glass-controls-visible #scene5-glass-controls:not([hidden]) .tp-dfwv {
  display: block !important;
}

html[data-active-scene="scene5"] body.scene5-glass-controls-available #scene5-glass-toggle:not([hidden]) {
  display: block !important;
}

#scene5-glass-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1102;
  padding: 9px 14px;
  border: 1px solid rgb(230 236 255 / 24%);
  border-radius: 6px;
  background: #202127;
  color: #eef2ff;
  font: 12px var(--font-body, "Geist", sans-serif);
  cursor: pointer;
  pointer-events: auto;
}

#scene5-glass-controls .scene5-glass-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px;
  border-radius: 6px 6px 0 0;
  background: #202127;
  color: #c4c5ce;
  font-size: 11px;
}

#scene5-glass-controls .scene5-glass-toolbar input {
  box-sizing: border-box;
  width: 100%;
  padding: 8px;
  border: 1px solid #555762;
  border-radius: 4px;
  background: #15161b;
  color: #eef2ff;
  font: inherit;
}

#scene5-glass-controls .scene5-glass-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

#scene5-glass-controls .scene5-glass-actions button {
  flex: 1;
  padding: 6px;
  border: 0;
  border-radius: 4px;
  background: #42454f;
  color: #eef2ff;
  font: inherit;
  cursor: pointer;
}

#scene5-glass-controls .scene5-glass-toolbar p { margin: 10px 0 0; }

#scene5-glass-toggle:focus-visible,
#scene5-glass-controls .scene5-glass-toolbar :focus-visible {
  outline: 2px solid #d6edff;
  outline-offset: 2px;
}

/* Both the standalone preview and embedded scene use these exceptions.
 * Tweakpane 4 mounts .tp-rotv roots inside custom containers; the containers
 * AND their roots must override the presentation gate. Respect [hidden] so
 * keyboard toggles and renderer handoffs cannot leave orphaned panels. */
html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-left-controls-column,
html[data-active-scene="scene5"] body.scene5-waypoint-controls-visible #scene5-left-controls-column {
  display: flex !important;
}

html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-light-controls:not([hidden]),
html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-added-light-controls:not([hidden]),
html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-light-controls:not([hidden]) .tp-rotv,
html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-light-controls:not([hidden]) .tp-dfwv,
html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-added-light-controls:not([hidden]) .tp-rotv,
html[data-active-scene="scene5"] body.scene5-light-controls-visible #scene5-added-light-controls:not([hidden]) .tp-dfwv,
html[data-active-scene="scene5"] body.scene5-waypoint-controls-visible #scene5-waypoint-controls:not([hidden]),
html[data-active-scene="scene5"] body.scene5-waypoint-controls-visible #scene5-waypoint-controls:not([hidden]) .tp-rotv,
html[data-active-scene="scene5"] body.scene5-waypoint-controls-visible #scene5-waypoint-controls:not([hidden]) .tp-dfwv {
  display: block !important;
}

/* The post-Scene 5 renderer exposes camera and waypoint values only while
 * its lifecycle owns input. Scope the exception to its authoring GUI so
 * lighting and scene-specific tuning panels keep their presentation gate. */
html body.waypoint-controls-enabled.waypoint-controls-visible #waypoints:not([hidden]),
html body.waypoint-controls-enabled.waypoint-controls-visible #waypoint-camera-controls:not([hidden]),
html body.waypoint-controls-enabled.waypoint-controls-visible #waypoint-camera-controls:not([hidden]) .lil-gui:not([hidden]) {
  display: block !important;
}
