:root {
  --glass-bg: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  --neon-pink: #ff0055;
  --neon-blue: #00e5ff;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 100%, #12001f, #000000 80%);
  font-family: "Aldrich", sans-serif;
  user-select: none;
  height: 100vh;
  width: 100vw;
}

canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Glassmorphism Base Class */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  color: white;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Center Message */
.message-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 2;
  pointer-events: none;
  padding: 40px 60px;
}

h1 {
  font-size: 5rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(
    to right,
    #444 20%,
    #ff00de 40%,
    #00ffde 60%,
    #444 80%
  );
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 5s linear infinite;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}

p {
  font-size: 1.1rem;
  margin-top: 15px;
  opacity: 0.6;
  font-weight: 200;
  letter-spacing: 1px;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

/* Controls Container */
.controls {
  position: absolute;
  bottom: 30px;
  right: 30px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  min-width: 200px; /* Slightly wider for inputs */
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch-label {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  transition: 0.4s;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: #888;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: rgba(255, 0, 85, 0.2);
  border-color: var(--neon-pink);
  box-shadow: 0 0 10px var(--neon-pink);
}

input:checked + .slider.sound-active {
  background-color: rgba(0, 229, 255, 0.2);
  border-color: var(--neon-blue);
  box-shadow: 0 0 10px var(--neon-blue);
}

input:checked + .slider:before {
  transform: translateX(23px);
  background-color: #fff;
}

/* Range Sliders & Inputs */
.range-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-input {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  margin-top: 5px;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

/* Number Input Styles */
.num-input {
  width: 50px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  font-family: "Aldrich", sans-serif;
  font-size: 0.85rem;
  text-align: center;
}

.num-input:focus {
  outline: none;
  border-color: var(--neon-blue);
  background: rgba(0, 0, 0, 0.5);
}

/* Dynamic Control Visibility */
#chaosSettings {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.4s ease, margin 0.4s ease;
}

#chaosSettings.visible {
  max-height: 80px; /* Increased height for number input */
  opacity: 1;
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 15px;
}

/* Hide UI Button */
.ui-toggle-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.ui-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.ui-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: rgba(255, 255, 255, 0.7);
}

.ui-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.message-container.ui-hidden {
  transform: translate(-50%, -50%) scale(0.95);
}

.hint {
  position: absolute;
  bottom: 20px;
  left: 30px;
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  z-index: 2;
  transition: opacity 0.5s ease;
}

@media (max-width: 700px) {
  h1 {
    font-size: 3rem;
  }
  .message-container {
    width: 80%;
    padding: 30px 20px;
    top: 40%;
  }
  .controls {
    top: 20px;
    right: auto;
    left: 20px;
    bottom: auto;
  }
  .ui-toggle-btn {
    top: 20px;
    right: 20px;
  }
}
