.converter {
  width: 100%;
  min-width: 0;
}

.converter__card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.15rem 1.35rem;
  min-width: 0;
}

.converter__title {
  margin: 0 0 1.15rem;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
  color: var(--text);
  line-height: 1.15;
}

.converter__form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.url-input {
  display: grid;
  gap: 0.45rem;
}

.url-input__field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tap);
  min-width: 0;
  max-width: 100%;
  padding: 0 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}

.url-input__field:focus-within {
  border-color: var(--border-strong);
}

.url-input__field.is-invalid {
  border-color: var(--border-strong);
}

.url-input__field.is-valid {
  border-color: var(--border-strong);
}

.url-input__icon,
.url-input__clear {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
}

.url-input__clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.35rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.url-input__clear:hover {
  background: var(--bg-hover);
}

.url-input__control {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  padding: 0.85rem 0;
  caret-color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.url-input__control::placeholder {
  color: var(--text-faint);
}

.url-input__control:focus {
  outline: none;
}

.url-input__status {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.url-input__status.is-error {
  color: var(--text);
}

.video-preview {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.video-preview__thumb {
  flex: none;
  width: 6.5rem;
  height: 3.65rem;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}

.video-preview__meta {
  min-width: 0;
  flex: 1;
}

.video-preview__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-preview__duration {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.format-selector {
  display: flex;
  gap: 0.5rem;
}

.format-selector[hidden] {
  display: none;
}

.format-selector__btn {
  appearance: none;
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.format-selector__btn.is-active {
  background: var(--btn);
  color: var(--btn-text);
  border-color: var(--btn);
  cursor: default;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: var(--tap);
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn--primary {
  background: var(--btn);
  color: var(--btn-text);
}

.btn--primary:hover:not(:disabled) {
  background: var(--btn-hover);
}

.btn--primary:active:not(:disabled) {
  background: var(--btn-active);
  transform: translateY(1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  background: var(--bg-hover);
}

.btn:disabled {
  cursor: not-allowed;
  background: rgba(246, 246, 246, 0.14);
  color: rgba(246, 246, 246, 0.45);
  border-color: transparent;
}

.btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.progress {
  display: grid;
  gap: 0.85rem;
  justify-items: center;
  text-align: center;
  padding: 0.5rem 0 0.15rem;
}

.progress__label {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.progress__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.progress__track {
  width: 100%;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress__bar {
  height: 100%;
  width: 0;
  background: var(--text);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.progress__bar.is-indeterminate {
  width: 36%;
  animation: slide 1.1s ease-in-out infinite;
}

.progress__value {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(2, 63, 136, 0.25);
  border-top-color: var(--btn-text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn .spinner {
  border-color: rgba(2, 63, 136, 0.2);
  border-top-color: var(--btn-text);
}

.result,
.error-state {
  display: grid;
  gap: 0.9rem;
  justify-items: stretch;
  text-align: center;
}

.result__icon,
.error-state__icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0.15rem auto 0;
  color: var(--text);
}

.result__title,
.error-state__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.result__file,
.error-state__message {
  margin: -0.35rem 0 0.15rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@media (max-width: 374px) {
  .converter__card {
    padding: 1rem 0.85rem 1.15rem;
  }

  .video-preview__thumb {
    width: 5.5rem;
    height: 3.1rem;
  }
}

@media (min-width: 768px) {
  .converter__card {
    padding: 1.75rem 1.6rem 1.85rem;
  }

  .converter__title {
    margin-bottom: 1.35rem;
  }
}
