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

body {
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

img {
  max-width: 100%;
}

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

/* --- Toggle button --- */
#config-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 34px;
  height: 34px;
  background: rgba(255 255 255 / 0.08);
  border: 1px solid rgba(255 255 255 / 0.15);
  border-radius: 8px;
  color: rgba(255 255 255 / 0.7);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#config-toggle:hover { background: rgba(255 255 255 / 0.15); }

/* --- Panel --- */
#config-panel {
  position: fixed;
  top: 0;
  right: -260px;
  width: 240px;
  height: 100vh;
  overflow-y: auto;

  background: rgba(12 12 18 / 0.96);
  border-left: 1px solid rgba(255 255 255 / 0.08);
  padding: 56px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: right 0.22s ease;
  z-index: 19;


  /* 1. Modern Scrollbar Styling (Standard) */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;

  /* 2. Advanced Scroll Logic */
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-gutter: stable; /* Prevents "jumping" when scrollbar appears */

  /* 3. Snap Alignment (Optional: stops items at specific points) */
  scroll-snap-type: y proximity;

  /* --- Nested Child Styles --- */

  & .config-section {
    scroll-snap-align: start;
    margin-bottom: 2rem;
 
    & h2 {
      position: sticky; /* Modern approach to keep headers visible */
      top: 0;
      background: inherit;
      padding: 0.5rem 0;
      font-size: 1.25rem;
      z-index: 10;
    }
  }

  /* 4. Legacy Webkit Styles (Nested) */
  &::-webkit-scrollbar {
    width: 6px;
  }

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

  &::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 100px;

    &:hover {
      background-color: #94a3b8;
    }
  }


}
#config-panel.open { right: 0; }

.panel-title {
  position: absolute;
  top: 18px;
  left: 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255 255 255 / 0.3);
}

#config-panel section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#config-panel section > label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255 255 255 / 0.35);
}

/* --- Option buttons --- */
.opt-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.opt {
  flex: 1;
  padding: 6px 4px;
  flex-basis: 30%;
  background: rgba(255 255 255 / 0.04);
  border: 1px solid rgba(255 255 255 / 0.1);
  border-radius: 6px;
  color: rgba(255 255 255 / 0.5);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.opt:hover { background: rgba(255 255 255 / 0.09); color: #fff; }
.opt.active {
  background: rgba(255 255 255 / 0.14);
  border-color: rgba(255 255 255 / 0.28);
  color: #fff;
}

/* --- Color rows --- */
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-row label {
  font-size: 12px;
  color: rgba(255 255 255 / 0.55);
  min-width: 30px;
  text-transform: none;
  letter-spacing: 0;
}
input[type="color"] {
  width: 38px;
  height: 26px;
  padding: 2px;
  border: 1px solid rgba(255 255 255 / 0.15);
  border-radius: 5px;
  background: rgba(255 255 255 / 0.06);
  cursor: pointer;
}

/* --- Decay slider --- */
input[type="range"] {
  width: 100%;
  accent-color: #fff;
  cursor: pointer;
  height: 4px;
}
#config-panel section label span {
  float: right;
  color: rgba(255 255 255 / 0.55);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* --- Mic select --- */
#mic-select {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255 255 255 / 0.05);
  border: 1px solid rgba(255 255 255 / 0.12);
  border-radius: 6px;
  color: rgba(255 255 255 / 0.8);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  outline: none;
}
#mic-select option {
  background: #141420;
  color: #fff;
}

/* --- Background image picker --- */
input[type="file"] { display: none; }

.file-pick-btn {
  display: block;
  padding: 6px 10px;
  background: rgba(255 255 255 / 0.05);
  border: 1px solid rgba(255 255 255 / 0.12);
  border-radius: 6px;
  color: rgba(255 255 255 / 0.7);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.13s;
}
.file-pick-btn:hover { background: rgba(255 255 255 / 0.1); color: #fff; }

#bg-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
#bg-no-image {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255 60 60 / 0.75);
  font-size: 11px;
}
#bg-no-image svg {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
#bg-preview-img {
  width: 52px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255 255 255 / 0.15);
}
#bg-clear {
  flex: 1;
  padding: 5px 8px;
  background: rgba(255 60 60 / 0.12);
  border: 1px solid rgba(255 60 60 / 0.28);
  border-radius: 5px;
  color: rgba(255 130 130 / 0.9);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.13s;
}
#bg-clear:hover { background: rgba(255 60 60 / 0.24); }

.hidden { display: none !important; }

/* --- SVG overlay --- */
#svg-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#svg-overlay svg {
  width: 70%;
  height: 70%;
  inset: 0;
}

/* --- SVG list --- */
#svg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.svg-empty {
  font-size: 11px;
  color: rgba(255 255 255 / 0.25);
  text-align: center;
  padding: 6px 0;
}
.svg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  background: rgba(255 255 255 / 0.04);
  border: 1px solid rgba(255 255 255 / 0.08);
  border-radius: 6px;
  transition: border-color 0.13s;
}
.svg-item.active {
  border-color: rgba(255 255 255 / 0.35);
  background: rgba(255 255 255 / 0.1);
}
.svg-thumb {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255 255 255 / 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.svg-thumb svg {
  width: 100%;
  height: 100%;
}
.svg-name {
  flex: 1;
  font-size: 11px;
  color: rgba(255 255 255 / 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.svg-del {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: rgba(255 60 60 / 0.1);
  border: 1px solid rgba(255 60 60 / 0.25);
  border-radius: 4px;
  color: rgba(255 100 100 / 0.8);
  font-size: 10px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.13s;
}
.svg-del:hover { background: rgba(255 60 60 / 0.28); }

/* --- Preload splash --- */
#preload {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s ease;
}
#preload.done {
  opacity: 0;
  pointer-events: none;
}

.preload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.mic-logo {
  width: 72px;
  height: 105px;
  animation: mic-glow 2s ease-in-out infinite;
}

@keyframes mic-glow {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(255 255 255 / 0.2)); opacity: 0.8; }
  50%       { filter: drop-shadow(0 0 30px rgba(255 255 255 / 0.6)); opacity: 1; }
}

.wiggle-bars {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 38px;
}

.wiggle-bars span {
  display: block;
  width: 4px;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transform-origin: center;
  animation: bar-wiggle 1.1s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.1s);
}

@keyframes bar-wiggle {
  0%, 100% { transform: scaleY(0.12); opacity: 0.25; }
  50%       { transform: scaleY(1);    opacity: 1; }
}
