* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #ffffff;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  overflow: hidden;
  min-height: 100vh;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#canvas-container canvas {
  display: block;
}

/* Control Panel */
#controls {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 260px;
  background: rgba(18, 18, 22, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

#controls.minimized {
  transform: translateX(calc(100% + 20px));
}

/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: #fff;
}

/* Minimize toggle button */
#controls-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(18, 18, 22, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

#controls-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

#controls.minimized ~ #controls-toggle {
  opacity: 1;
  pointer-events: auto;
}

/* Sections */
.section {
  margin-bottom: 16px;
}

.section:last-child {
  margin-bottom: 0;
}

/* Range Sliders */
input[type="range"] {
  flex: 1;
  height: 3px;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 0 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* Select Dropdown */
select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  margin-bottom: 10px;
}

select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

select option {
  background: #1a1a1e;
  color: #fff;
  padding: 8px;
}

select optgroup {
  background: #1a1a1e;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  font-style: normal;
}

/* Buttons */
.btn {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn.active {
  background: rgba(0, 200, 255, 0.2);
  border-color: rgba(0, 200, 255, 0.4);
}

/* Source Row - File and Mic buttons */
.source-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.source-row .btn {
  flex: 1;
}

/* File Input - styled to match regular buttons */
.file-input-wrapper {
  position: relative;
  flex: 1;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-input-wrapper span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.file-input-wrapper:hover span {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Play Button - Very Prominent */
.btn-play {
  width: 100%;
  padding: 14px 20px;
  margin-top: 12px;
  background: linear-gradient(135deg, #00ddff 0%, #0099cc 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 180, 220, 0.3);
  transition: all 0.2s ease;
}

.btn-play:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 180, 220, 0.4);
  background: linear-gradient(135deg, #00eeff 0%, #00aadd 100%);
}

.btn-play:active:not(:disabled) {
  transform: translateY(0);
}

.btn-play:disabled {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  opacity: 0.5;
}

.btn-play .play-icon {
  font-size: 12px;
}

.btn-play .play-text {
  letter-spacing: 0.05em;
}

/* Status Text */
.status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status.loading {
  color: rgba(255, 200, 0, 0.8);
}

/* Slider Row - inline layout */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.slider-row:last-child {
  margin-bottom: 0;
}

.slider-row label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  min-width: 65px;
}

.slider-value {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Checkbox Row */
.checkbox-row {
  margin-top: 6px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #00ddff;
}

/* Export Row */
.export-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.export-row .btn {
  flex: 1;
}


/* D3 Container */
#d3-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
  background: #fff;
}

#d3-container.active {
  display: block;
}

#d3-container svg {
  width: 100%;
  height: 100%;
}

/* LED Container */
#led-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
  background: #111;
}

#led-container.active {
  display: block;
}

#led-container svg {
  width: 100%;
  height: 100%;
}

/* Particles Container */
#particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: none;
  background: #0a0a0a;
}

#particles-container.active {
  display: block;
}

/* Viz controls */
.viz-controls {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Visualization Grid - 2x2 */
.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.viz-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
}

.viz-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.viz-btn.active {
  background: rgba(0, 200, 255, 0.15);
  border-color: rgba(0, 200, 255, 0.5);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.15);
}

.viz-icon {
  font-size: 22px;
  line-height: 1;
}

.viz-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 600px) {
  #controls {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 50vh;
    overflow-y: auto;
  }

  #controls.minimized {
    transform: translateY(100%);
  }

  #controls-toggle {
    top: auto;
    bottom: 16px;
    right: 16px;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
