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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0f;
  color: #e0e0e6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.app {
  width: 100%;
  max-width: 460px;
  background: rgba(18, 18, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 2rem 1.8rem;
  backdrop-filter: blur(12px);
}

header { text-align: center; margin-bottom: 1.4rem; }

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7b5ea7, #5b8def);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle { font-size: 0.78rem; color: #666; margin-top: 0.25rem; }

/* ── Upload ── */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem;
  border: 1.5px dashed #2a2a3a;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  text-align: center;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #5b8def;
  background: rgba(91, 141, 239, 0.04);
}

.upload-icon { font-size: 1.4rem; color: #5b8def; }
.upload-text { font-size: 0.82rem; color: #888; }

.file-name {
  font-size: 0.75rem;
  color: #5b8def;
  min-height: 1em;
  word-break: break-all;
}

/* ── Canvas visualizer ── */
#visualizer {
  display: block;
  width: 280px;
  height: 280px;
  margin: 1.2rem auto;
  border-radius: 14px;
}

/* ── Transport ── */
.transport {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.play-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #7b5ea7, #5b8def);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.2s;
}

.play-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.play-btn:not(:disabled):hover { transform: scale(1.08); }
.play-btn:not(:disabled):active { transform: scale(0.95); }

.play-icon { pointer-events: none; }

.time {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: #666;
  font-variant-numeric: tabular-nums;
  min-width: 72px;
  text-align: center;
}

/* ── Shared range slider base ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  outline: none;
  background: #1a1a2a;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #5b8def;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(91, 141, 239, 0.4);
  transition: transform 0.1s;
}

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

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #5b8def;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(91, 141, 239, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #1a1a2a;
}

.progress-bar { flex: 1; }

.volume-slider { width: 60px; flex-shrink: 0; }

/* ── Mode selector ── */
.mode-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1.4rem;
}

.mode-btn {
  padding: 0.4rem 0.85rem;
  border: 1px solid #2a2a3a;
  border-radius: 20px;
  background: transparent;
  color: #888;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.25s;
}

.mode-btn:hover {
  border-color: #5b8def;
  color: #c0c0cc;
}

.mode-btn.active {
  background: linear-gradient(135deg, #7b5ea7, #5b8def);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 12px rgba(91, 141, 239, 0.3);
  animation: mode-glow 2s ease-in-out infinite;
}

@keyframes mode-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(91, 141, 239, 0.25); }
  50% { box-shadow: 0 0 16px rgba(91, 141, 239, 0.45); }
}

/* ── Sliders section ── */
.sliders { margin-bottom: 1.4rem; }

.slider-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

.slider-group label {
  flex: 0 0 80px;
  text-align: left;
  font-size: 0.8rem;
  color: #999;
}

.slider-group input[type="range"] { flex: 1; }

.slider-val {
  flex: 0 0 40px;
  text-align: right;
  font-size: 0.75rem;
  color: #666;
  font-variant-numeric: tabular-nums;
}

/* ── Presets ── */
.presets { border-top: 1px solid rgba(255, 255, 255, 0.05); padding-top: 1rem; }

.preset-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.preset-input,
.preset-select {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  background: #121220;
  color: #ccc;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}

.preset-input:focus,
.preset-select:focus { border-color: #5b8def; }

.preset-select { cursor: pointer; }

.preset-btn {
  padding: 0.4rem 0.7rem;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  background: #1a1a2a;
  color: #999;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.preset-btn:hover { border-color: #5b8def; color: #ddd; }
.preset-btn-danger:hover { border-color: #e05555; color: #e05555; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .app { padding: 1.4rem 1.2rem; }
  #visualizer { width: 220px; height: 220px; }
  .slider-group label { flex: 0 0 65px; font-size: 0.75rem; }
  .mode-btn { padding: 0.35rem 0.6rem; font-size: 0.72rem; }
  .time { font-size: 0.65rem; min-width: 60px; }
}