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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
  align-items: end;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-weight: 600;
  color: #555;
  font-size: 0.9em;
}

input[type="file"] {
  padding: 12px;
  border: 2px dashed #667eea;
  border-radius: 10px;
  background: #f8f9ff;
  cursor: pointer;
  transition: all 0.3s ease;
}

input[type="file"]:hover {
  border-color: #764ba2;
  background: #f0f1ff;
}

input[type="range"] {
  width: 200px;
  height: 8px;
  border-radius: 5px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

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

.speed-display {
  font-size: 0.9em;
  color: #667eea;
  font-weight: 600;
}

button {
  padding: 15px 30px;
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#canvas {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: block;
  margin: 0 auto;
  background: transparent;
  background-image:
    radial-gradient(circle at 25% 25%, #fff 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, #fff 2px, transparent 2px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.canvas-container {
  text-align: center;
  margin-top: 20px;
}

@media (max-width: 600px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  input[type="range"] {
    width: 100%;
  }
}

/* Styles for generated HTML animation fallback */
.animation-fallback {
  margin: 0;
  padding: 20px;
  background: #f0f0f0;
  text-align: center;
  background-image:
    radial-gradient(circle at 25% 25%, #ccc 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, #ccc 2px, transparent 2px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.animation-fallback #animation {
  max-width: 100%;
  border-radius: 10px;
}
