/* Base styles */
body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #000;
  color: #fff;
  font-family: 'Geist', 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
}

canvas {
  display: block;
  margin: 0 auto;
}

#container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-top: 100px; /* Space for controls */
}

/* Controls container with cute glass-like effect */
#controls-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  pointer-events: all;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

#controls {
  width: 90%;
  margin: 0 auto;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(60, 60, 80, 0.8), rgba(40, 40, 60, 0.8));
  border-radius: 16px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  box-sizing: border-box;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 
              inset 0 1px 1px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Cute button styling */
button {
  padding: 10px 18px;
  background: linear-gradient(45deg, #6a5acd, #4a3aad);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  min-width: 80px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  height: 38px; /* Match control group height */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

button:hover::after {
  left: 100%;
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.special-button {
  background: linear-gradient(45deg, #ff6b6b, #ee5253);
}

/* Form controls styling */
select,
input {
  padding: 10px 12px;
  background-color: rgba(80, 80, 100, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  font-family: inherit;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

select:hover,
input:hover {
  background-color: rgba(90, 90, 110, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

select:focus,
input:focus {
  outline: none;
  border-color: rgba(106, 90, 205, 0.5);
  box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.2);
}

select {
  width: 120px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
  height: 34px; /* Match control group inner height */
  box-sizing: border-box;
}

label {
  font-weight: 500;
  margin-right: 8px;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

/* Control groups with consistent sizing */
.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(60, 60, 80, 0.4);
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 100px;
  max-width: 250px;
  height: 50px; /* Set fixed height */
  box-sizing: border-box; /* Include padding in height calculation */
}

/* Custom range input styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  background: rgba(40, 40, 60, 0.6);
  border-radius: 3px;
  outline: none;
  padding: 0;
  margin: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6a5acd;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6a5acd;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border: none;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #8a7aed;
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb:hover {
  background: #8a7aed;
  transform: scale(1.1);
}

.slider-value {
  min-width: 2.5em;
  text-align: center;
  background-color: rgba(106, 90, 205, 0.3);
  padding: 3px 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Loading overlay with cute styling */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(20, 20, 40, 0.95), rgba(10, 10, 20, 0.98));
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

#loading-message {
  color: white;
  font-size: 24px;
  text-align: center;
  padding: 30px 40px;
  background-color: rgba(60, 60, 100, 0.4);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: pulse 2s infinite;
  backdrop-filter: blur(4px);
  max-width: 80%;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Media queries for better responsiveness */
@media (max-width: 768px) {
  #controls {
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: center; /* Center items when wrapping */
    overflow-x: visible; /* Disable horizontal scrolling when wrapping */
  }
  
  .control-group {
    max-width: 100%;
    width: auto; /* Adjust width to auto when wrapping */
    min-width: 180px; /* Slightly increase min-width for wrapped items */
  }
  
  button {
    width: auto; /* Adjust button width to auto when wrapping */
    min-width: 80px; /* Re-apply min-width for buttons */
  }
}

@media (max-width: 480px) {
  #controls-container {
    padding: 8px 0;
  }
  
  #controls {
    width: 95%;
    padding: 10px;
  }
  
  .control-group {
    padding: 6px 10px;
  }
}

/* Pinball element styles */
.bumper {
    filter: drop-shadow(0 0 10px rgba(255, 100, 100, 0.8));
}

.leaf {
    background: linear-gradient(90deg, #4a9, #6ba);
    opacity: 0.8;
}

/* Mode Toggle Switch */
.mode-toggle-group {
  min-width: 180px;
}

.mode-switch {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 34px;
}

.mode-switch input {
  display: none;
}

.switch-label {
  position: relative;
  display: block;
  height: 34px;
  background: rgba(40, 40, 60, 0.6);
  border-radius: 17px;
  cursor: pointer;
  transition: 0.3s;
  overflow: hidden;
  text-align: center;
  line-height: 34px;
}

.switch-label:before {
  content: '';
  position: absolute;
  width: 60px;
  height: 28px;
  border-radius: 14px;
  top: 3px;
  left: 3px;
  background: #6a5acd;
  transition: 0.3s;
}

.switch-label .play,
.switch-label .edit {
  position: absolute;
  width: 60px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
}

.switch-label .play {
  left: 5px;
}

.switch-label .edit {
  right: 5px;
}

.mode-switch input:checked + .switch-label:before {
  transform: translateX(54px);
  background: #ee5253;
}
