/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}

.subtitle {
  color: #888;
  margin-top: 0.5rem;
  font-size: 1rem;
}

/* Upload area */
.upload-area {
  border: 2px dashed #333;
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #646cff;
  background: rgba(100, 108, 255, 0.05);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-or {
  color: #555;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.upload-btn {
  display: inline-block;
  padding: 0.7rem 1.8rem;
  background: #646cff;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s;
}

.upload-btn:hover {
  background: #535bf2;
}

.upload-hint {
  color: #555;
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* Editor */
.editor {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: #1a1a1a;
  border-radius: 12px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-group label {
  font-size: 0.8rem;
  color: #aaa;
}

.control-group input[type="range"] {
  width: 120px;
  accent-color: #646cff;
}

.control-group select {
  padding: 0.4rem 0.6rem;
  background: #2a2a2a;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.control-buttons {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

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

.btn-primary {
  background: #646cff;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #535bf2;
}

.btn-secondary {
  background: #2a2a2a;
  color: #e0e0e0;
}

.btn-secondary:hover:not(:disabled) {
  background: #333;
}

.btn-ghost {
  background: transparent;
  color: #888;
  border: 1px solid #333;
}

.btn-ghost:hover {
  color: #e0e0e0;
  border-color: #555;
}

/* Preview area */
.preview-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.preview-panel {
  position: relative;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 1rem;
  overflow: hidden;
}

.preview-panel h3 {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.preview-panel canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #111;
}

/* Processing overlay */
.processing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 15, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  gap: 1rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #333;
  border-top-color: #646cff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 700px) {
  .preview-area {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-buttons {
    margin-left: 0;
    justify-content: stretch;
  }

  .control-buttons .btn {
    flex: 1;
  }

  .control-group input[type="range"] {
    width: 100%;
  }
}
