/* A single persistent gear owns the same real controls, independently of scene fades. */
body #site-experience-controls, body #site-experience-controls * { box-sizing: border-box; }
body #world-controls:empty { display: none; }
body #site-experience-controls {
  position: fixed; inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) auto;
  z-index: 200; display: flex; flex-direction: column; align-items: flex-end;
  width: max-content; max-width: calc(100vw - 32px); margin: 0; padding: 0;
  color: #f3f4f1; font: 500 12px/1.4 Inter, Arial, sans-serif; text-align: left;
}
body #site-experience-controls button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 44px; min-height: 44px; padding: 9px 12px; margin: 0;
  border: 1px solid #526172; border-radius: 999px; background: #152338; color: #f3f4f1;
  font: 600 11px/1.4 Inter, Arial, sans-serif; white-space: nowrap; text-align: center; cursor: pointer;
}
body #site-experience-controls #site-settings-toggle { width: 48px; height: 48px; padding: 12px; box-shadow: 0 6px 25px #0003; }
body #site-experience-controls #site-settings-toggle[aria-expanded="true"] { border-color: #d6ff46; }
body #site-experience-controls button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
body #site-experience-controls #site-settings-toggle svg { width: 22px; height: 22px; }
body #site-experience-controls :is(button, input):focus-visible { outline: 2px solid #d6ff46; outline-offset: 3px; }
body #site-settings-panel {
  position: absolute; right: 0; bottom: calc(100% + 12px); width: 286px; max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 96px); overflow: auto; overscroll-behavior: contain;
  padding: 14px; background: #101b2bf5; border: 1px solid #526172; border-radius: 16px; box-shadow: 0 8px 28px #0005;
  opacity: 1; transform: translateY(0);
  transition-property: opacity, transform, display;
  transition-duration: 360ms;
  transition-timing-function: cubic-bezier(.22, .61, .36, 1);
  transition-behavior: allow-discrete;
}
/* Keep display until the fade ends; rapid toggles reverse natively, without timers. */
body #site-settings-panel[hidden] {
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(.4, 0, 1, 1);
}
@starting-style {
  body #site-settings-panel { opacity: 0; transform: translateY(12px); }
}
body.motion-off #site-settings-panel { transition: none; }
@media (prefers-reduced-motion: reduce) {
  body #site-settings-panel { transition: none; }
}
body #site-settings-panel .site-settings-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -5px -5px 10px 0; font: 600 14px/1.4 Inter, Arial, sans-serif; }
body #site-settings-panel #site-settings-close { background: transparent; border: 0; border-radius: 8px; padding: 0; width: 44px; height: 44px; }
body #site-settings-panel #site-settings-close img { display: block; width: 34px; height: 28px; }
body #site-settings-panel .world-status-line { font: 500 10px/1.4 Inter, Arial, sans-serif; margin: 0 0 14px; color: #bcc7d5; }
body #site-settings-panel .world-control-row { display: grid; grid-template-columns: 94px minmax(0,1fr); align-items: end; gap: 10px 16px; }
body #site-settings-panel .world-control-row > button { grid-column: 2; width: 100%; align-self: start; }
body #site-settings-panel .world-control-row button span { font: inherit; }
body #site-settings-panel #world-reset { grid-row: 3; }
body #site-settings-panel #motion-toggle { grid-row: 1; }
body #site-settings-panel #black-hole-toggle { grid-row: 2; }
body #site-sound-controls { grid-column: 1; grid-row: 1 / span 3; display: flex; flex-direction: column; align-items: stretch; gap: 10px; min-width: 0; }
body #site-sound-controls .site-sound-level { display: flex; flex-direction: column; align-items: center; gap: 6px; }
body #site-sound-controls label { font-size: 11px; }
body #site-sound-controls output { font-size: 12px; white-space: nowrap; }
/* Native vertical geometry: maximum at the top, no rotated hit target. */
body #site-sound-controls input { writing-mode: vertical-lr; direction: rtl; width: 44px; height: clamp(96px, 20dvh, 144px); min-height: 96px; margin: 0; accent-color: #d6ff46; cursor: ns-resize; }
body #site-sound-controls #site-sound-toggle { width: 94px; }
body #site-sound-toggle::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #a8b0bb; }
body #site-sound-toggle[aria-pressed="true"]::before { background: #d6ff46; }
body #site-sound-controls .site-sound-device { font-size: 10px; text-align: center; }
body #site-sound-controls .site-sound-status { grid-column: 1 / -1; font-size: 11px; }
body #site-experience-controls [hidden] { display: none !important; }
/* The same controls occupy a footer inside a modal, avoiding clipped popups. */
body dialog > #site-experience-controls { position: sticky; inset: auto; bottom: 0; margin: 16px 0 0 auto; flex-shrink: 0; max-width: 100%; }
body dialog #site-settings-panel { position: relative; inset: auto; order: -1; margin-bottom: 12px; max-width: 100%; max-height: max(100px, calc(100dvh - 220px)); }
body :is(#section-dialog, #product-dialog.workflow-dialog) > #site-experience-controls { position: relative; inset: auto; margin: 0 16px 16px auto; max-width: calc(100% - 32px); }
@media (max-width: 600px) { body #site-settings-panel .world-status-line { display: none; } }
@media print { body #site-experience-controls { display: none !important; } }
