body { font-family: Inter, sans-serif; }

.tool-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

@media (max-width: 640px) {
  .tool-card {
    padding: 1rem;
  }
}

/* Theremin XY Pad - Bleeds to card edges on top */
.theremin-pad-wrapper {
  position: relative;
  width: calc(100% + 3rem);
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  aspect-ratio: 16/9;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  border-radius: 0.9rem 0.9rem 0 0;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  touch-action: none; /* Prevents scrolling while dragging on touch screens */
}

@media (max-width: 640px) {
  .theremin-pad-wrapper {
    width: calc(100% + 2rem);
    margin: -1rem -1rem 1rem -1rem;
    aspect-ratio: 4/3;
  }
}

#thereminPad {
  width: 100%;
  height: 100%;
  display: block;
}

/* Glassmorphic Pad Overlay Instructions */
.pad-instructions {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #f1f5f9;
  text-align: center;
  transition: opacity 0.4s ease;
  pointer-events: none; /* Allows mouse/touch events to fall through to the canvas */
}

.pad-instructions.hidden {
  opacity: 0;
}

.pad-instructions svg {
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.8));
  }
}

/* Interactive Controls and Sliders */
.control-card-sub {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.85rem;
  transition: border-color 0.2s;
}

.control-card-sub:hover {
  border-color: #cbd5e1;
}

/* Theremin Value Indicators */
.theremin-value {
  font-weight: 700;
  color: #0f172a;
  font-family: monospace;
}
.theremin-value.playing {
  color: #6366f1;
}

/* Grid overlay axes */
.bar-track {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #6366f1; /* Pitch: Indigo */
  width: 0%;
  transition: width 0.05s linear;
}
.bar-fill.vol {
  background: #10b981; /* Volume: Emerald */
}

/* Real-time Oscilloscope */
#waveCanvas {
  width: 100%;
  height: 60px;
  display: block;
  border-radius: 0.5rem;
  background: #090d16;
  border: 1px solid #1e293b;
}

/* Scale lock notes container */
.note-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  transition: all 0.15s ease;
  user-select: none;
}
.note-badge.active-badge {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
  transform: scale(1.05);
}

/* Custom Neon Range Input Slider styling */
input[type="range"].neon-slider {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}
input[type="range"].neon-slider:focus {
  outline: none;
}
input[type="range"].neon-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  background: #cbd5e1;
  border-radius: 3px;
  border: none;
}
input[type="range"].neon-slider::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -5.5px;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
  transition: transform 0.1s, background-color 0.1s;
}
input[type="range"].neon-slider:active::-webkit-slider-thumb {
  transform: scale(1.2);
  background: #4f46e5;
}

input[type="range"].neon-slider-emerald::-webkit-slider-thumb {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
input[type="range"].neon-slider-emerald:active::-webkit-slider-thumb {
  background: #059669;
}
input[type="range"].neon-slider-emerald::-webkit-slider-runnable-track {
  background: #cbd5e1;
}

/* Toggle Switch Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #6366f1;
}
input:checked + .slider:before {
  transform: translateX(18px);
}
