.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.control-threshold {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.control-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.threshold-track {
  display: flex;
  align-items: center;
  gap: 6px;
}

.threshold-end {
  font-size: 8px;
  color: var(--text-muted);
  line-height: 1;
}

#thresholdSlider,
#sharpnessSlider {
  width: 140px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--surface-2), var(--text-secondary));
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#thresholdSlider::-webkit-slider-thumb,
#sharpnessSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid var(--surface-0);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

#thresholdSlider::-webkit-slider-thumb:hover,
#sharpnessSlider::-webkit-slider-thumb:hover {
  box-shadow: var(--shadow-accent);
}

#thresholdSlider::-moz-range-thumb,
#sharpnessSlider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid var(--surface-0);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.threshold-value {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.control-chars {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chars-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.chars-bar {
  width: 100px;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.chars-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s, background 0.2s;
}

.chars-bar.warning .chars-fill {
  background: var(--warning);
}

.chars-bar.danger .chars-fill {
  background: var(--danger);
}

.chars-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.error {
  text-align: center;
  padding: 20px 16px;
  color: var(--error);
  font-size: 13px;
  background: var(--error-subtle);
  border: 1px solid var(--error-border);
  border-radius: 10px;
  margin-top: 16px;
}

.loading {
  text-align: center;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-blink {
  display: inline-block;
  animation: blink 1s step-end infinite;
  margin-right: 4px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border-subtle);
  z-index: 100;
  animation: toast-in 0.25s ease;
}

@media (max-width: 640px) {
  .drop-zone {
    padding: 32px 16px;
    border-radius: 12px;
  }

  .preview-panel {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .preview-original {
    flex-direction: row;
    gap: 12px;
  }

  .preview-frame {
    width: 80px;
    flex-shrink: 0;
  }

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

  .control-threshold {
    justify-content: center;
  }

  .control-chars {
    justify-content: center;
  }

  .braille-output {
    font-size: 7px;
    padding: 10px;
  }
}
