body {
  margin: 0;
  overflow: hidden;
}
canvas {
  display: block;
}
#controls {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7); /* Darker for space theme */
  color: white;
  padding: 10px;
  border-radius: 5px;
  max-width: 300px; /* Slightly wider for better fit */
  font-family: Arial, sans-serif;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  max-height: calc(100vh - 40px); /* Limit height on mobile */
  overflow-y: auto; /* Allow scrolling for controls */
}
#controls summary {
  cursor: pointer;
}
#controls h4 {
  margin: 10px 0 5px;
  color: #ffd700; /* Golden accent */
}
.param {
  display: grid;
  grid-template-columns: auto 1fr auto; /* Name | Slider | Value */
  gap: 10px;
  align-items: center;
  margin: 5px 0;
}
.param .name {
  text-align: left;
  white-space: nowrap;
  min-width: 95px; /* Min width for names */
}
.param .slider {
  width: 100%;
}
.param .value {
  min-width: 50px;
  text-align: right;
  white-space: nowrap;
}
#materialPreset {
  width: 100%;
  margin-bottom: 10px;
}
@media (max-width: 768px) {
  #controls {
    max-width: calc(100vw - 20px);
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
  }
  #controls summary {
    font-size: 16px;
    padding: 5px; /* Reduced padding */
    cursor: pointer;
    position: sticky; /* Make it stick */
    top: 0;
    background: rgba(0, 0, 0, 0.85); /* Add background for sticky */
    z-index: 1; /* Ensure it's on top of panel content */
  }
}
