:root {
  color-scheme: dark;
  background: #000;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  cursor: none;
  user-select: none;
}

body {
  position: fixed;
  inset: 0;
  font-family: Arial, sans-serif;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

#stage {
  isolation: isolate;
}

#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

#stage.transitioning::after {
  animation: xwall-flash 360ms ease-out both;
}

#stage.transitioning .scene.active {
  animation: xwall-recoil 360ms ease-out both;
}

@keyframes xwall-flash {
  0% { opacity: 0; }
  24% { opacity: 0.92; }
  100% { opacity: 0; }
}

@keyframes xwall-recoil {
  0% { transform: scale(1); }
  28% { transform: scale(0.965); }
  100% { transform: scale(1); }
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  background: #000;
}

.scene.preparing {
  z-index: 0;
  visibility: hidden;
}

.scene.active {
  z-index: 2;
}

.scene.horizontal {
  display: block;
}

.scene.vertical {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.scene.prepared-composition {
  display: block;
}

.media-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  background: #000;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

video::-webkit-media-controls {
  display: none !important;
}

#music-layer {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

#music-layer audio {
  position: absolute;
  width: 1px;
  height: 1px;
}

#diagnostics {
  position: fixed;
  z-index: 10;
  right: 12px;
  bottom: 12px;
  max-width: min(520px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  font: 13px/1.35 monospace;
  white-space: pre-wrap;
  cursor: default;
}
