Create a complete, highly interactive p5.js simulation demonstrating: light refraction phenomenon

CRITICAL REQUIREMENTS:
1. ACCURACY: The simulation must be scientifically/mathematically accurate for light refraction phenomenon
2. FUNCTIONAL INTERACTIVITY: All sliders and buttons MUST actually control and modify the simulation behavior in real-time
3. EDUCATIONAL: Users should learn about light refraction phenomenon through experimentation and parameter manipulation
4. VISUAL PRECISION: Animations should be smooth, realistic, and visually accurate to real-world physics

MANDATORY INTERACTIVE ELEMENTS THAT MUST WORK:
- At least 4-6 sliders controlling key parameters with realistic ranges - these MUST change simulation behavior
- At least 3-4 buttons for actions (reset, pause/play, presets, etc.) - these MUST perform actual functions
- Real-time parameter display showing current values that update as sliders move
- Visual feedback that responds immediately and visibly to control changes
- Mouse interactions where physically meaningful

CRITICAL: CONTROLS MUST BE FUNCTIONAL, NOT DECORATIVE
- Every slider must control a variable that actively affects the simulation
- Every button must perform a meaningful action that changes the simulation state
- Parameter changes must be immediately visible in the simulation output
- Use the actual slider values in mathematical calculations and physics equations

ANIMATION AND TIMING REQUIREMENTS:
- Use realistic time scaling - avoid animations that are too fast or unrealistic
- Implement proper frame rate control using deltaTime or fixed timesteps
- Use realistic physical constants and scaling factors
- Ensure smooth, stable animations at 60fps
- Avoid conflicting visual elements or overlapping controls
- Make animations visually appealing and scientifically accurate

CONTROL IMPLEMENTATION REQUIREMENTS:
- Sliders: Use createSlider(min, max, default, step) with appropriate ranges that make physical sense
- Buttons: Use createButton('Label') with meaningful functions that actually execute
- Show parameter values with text() in the main canvas that update in real-time
- Use function declarations for event handlers: function resetSim() {} 
- ALWAYS use slider.value() in your calculations - never ignore slider inputs

CODE FORMAT REQUIREMENTS:
- Use GLOBAL MODE p5.js (NOT instance mode)
- Define setup() and draw() as regular functions
- All variables should be global (use let/var at top level)
- Use standard p5.js function names: createCanvas, background, fill, etc.
- NO sketch wrapper function - write direct p5.js code


IMPORTANT UI REQUIREMENT:
- After creating each slider or button, set its CSS to absolute positioning with a fixed top and left, and a fixed width.
- For example:
  slider.style('position', 'absolute');
  slider.style('top', '520px'); // or whatever value places it below your canvas
  slider.style('left', '100px'); // adjust as needed for each control
  slider.style('width', '120px');
- Do the same for buttons, adjusting the left value to space them horizontally.
- Always group all controls together in a horizontal row below the canvas, using absolute positioning.
- Do NOT use .position(x, y) for controls—use .style('position', 'absolute') and set top/left/width as above.


SIMULATION ACCURACY FOR LIGHT REFRACTION PHENOMENON:
- Use correct physics equations, mathematical relationships, or algorithmic principles
- Realistic parameter ranges and default values that make physical sense
- Smooth, continuous animations with proper time scaling
- Proper scaling and units where applicable
- Include scientific constants or realistic coefficients
- ENSURE every parameter controlled by sliders affects the simulation visibly
- Use appropriate time steps and scaling factors to avoid too-fast animations

TEXT AND DISPLAY REQUIREMENTS:
- Show ONLY the simulation title at the top
- Display ONLY key physics parameters (velocity, acceleration, force, etc.) - no instructions or explanations
- Keep text minimal and clean - maximum 4-5 parameter displays
- NO instruction text like "Click to...", "Drag to...", etc.
- Use concise parameter labels like "Velocity: 5.2 m/s" not "Current velocity value is 5.2"
- Position parameter text neatly in corners or edges, not cluttering the center

VISUAL REQUIREMENTS:
- Clear, educational visualization of the concept
- Multiple visual elements (trails, vectors, measurements, etc.) that don't conflict
- Color coding to distinguish different aspects
- Grid lines, axes, or reference markers where helpful
- Immediate and obvious visual response to parameter changes
- Smooth, realistic motion that matches real-world physics
- Proper visual hierarchy - important elements should stand out
- Clean, uncluttered display with minimal text

EXAMPLE OF FUNCTIONAL CONTROLS WITH PROPER TIMING:
```javascript
// Global variables that ACTUALLY affect simulation
let gravitySlider, dampingSlider;
let gravity = 0.5;  // This gets updated by slider
let damping = 0.99; // This gets updated by slider
let resetBtn, pauseBtn;
let isPaused = false;
let timeScale = 0.02; // Control animation speed

function setup() {
  createCanvas(400, 400);
  
  // Create sliders that CONTROL the simulation with realistic ranges
  gravitySlider = createSlider(0.1, 1.0, 0.4, 0.05);
  gravitySlider.position(10, height + 10);
  
  dampingSlider = createSlider(0.9, 1.0, 0.995, 0.001);
  dampingSlider.position(10, height + 40);
  
  // Create buttons that DO something - positioned to avoid overlap
  resetBtn = createButton('Reset');
  resetBtn.position(10, height + 40);
  
  pauseBtn = createButton('Pause/Play');
  pauseBtn.position(80, height + 40);
}

function draw() {
  background(220);
  
  // ACTUALLY USE the slider values - this is critical!
  gravity = gravitySlider.value();
  damping = dampingSlider.value();
  
  if (!isPaused) {
    // Use gravity and damping in actual physics calculations with proper time scaling
    velocity += gravity * timeScale;
    velocity *= damping;
    position += velocity;
  }
  
  // Show ONLY title and key parameters - keep it minimal
  fill(0);
  textAlign(CENTER);
  text('Light Refraction Phenomenon', width/2, 20);
  
  textAlign(LEFT);
  text('Gravity: ' + gravity.toFixed(2), 10, 40);
  text('Velocity: ' + velocity.toFixed(2), 10, 60);
  
  // Draw simulation that responds to parameters with realistic motion
  ellipse(position, height/2, 20, 20);
}

// Functions that actually work
function resetSimulation() {
  position = width/2;
  velocity = 0;
}

function togglePause() {
  isPaused = !isPaused;
}
```

IMPORTANT: 
- Focus on the specific physics, mathematics, or principles of light refraction phenomenon
- Make controls that ACTUALLY matter for understanding the concept
- Every slider must control a variable used in the simulation
- Every button must perform a visible action
- Ensure the simulation behaves realistically and responds to all controls
- Use proper time scaling to avoid unrealistically fast animations
- Position controls carefully to avoid visual conflicts
- Make animations smooth and scientifically accurate
- Keep text displays MINIMAL - only title and key parameters
- NO instruction text or explanations in the simulation
- Only output JavaScript code, no explanations
- Use global mode p5.js format (no sketch wrapper)
- Position controls below the 400x400 canvas with proper spacing

Generate an accurate, interactive simulation of: light refraction phenomenon with WORKING controls, REALISTIC timing, and MINIMAL text displays