:root {
  --blue: #0878ee;
  --blue-dark: #075fc2;
  --text: #17324d;
  --muted: #6d849c;
  --border: #d7e6f5;
  --background: #f3f9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px 16px;
  background: linear-gradient(135deg, #f7fbff, #eaf4ff);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.app {
  width: min(900px, 100%);
  margin: 0 auto;
}

.header {
  text-align: center;
  margin: 8px 0 24px;
}

.header h1 {
  margin: 0;
  color: var(--blue);
  font-size: 34px;
  line-height: 1.2;
}

.header p {
  margin: 9px 0 0;
  color: var(--muted);
}

.card {
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(21, 93, 170, 0.10);
}

.drop-zone {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #8ec3fb;
  border-radius: 18px;
  background: #f7fbff;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--blue);
  background: #edf7ff;
  transform: translateY(-1px);
}

.drop-content {
  padding: 25px;
}

.upload-icon {
  margin-bottom: 10px;
  font-size: 44px;
}

.drop-zone h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.drop-zone p {
  margin: 0;
  color: var(--muted);
}

#fileInput {
  display: none;
}

.preview {
  display: none;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fbfdff;
}

.preview.visible {
  display: grid;
}

.preview img {
  width: 140px;
  height: 110px;
  object-fit: contain;
  border-radius: 10px;
  background: #eef5fb;
}

.file-details h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.file-details p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 16px;
  margin-top: 20px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 800;
}

#targetSize,
.unit-box {
  width: 100%;
  height: 50px;
  border: 1px solid #cbdceb;
  border-radius: 11px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
}

#targetSize {
  outline: none;
}

#targetSize:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(8, 120, 238, 0.10);
}

.unit-box {
  display: flex;
  align-items: center;
  background: #f8fafc;
}

.convert-btn,
.download-btn {
  border: 0;
  border-radius: 11px;
  color: white;
  background: var(--blue);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}

.convert-btn {
  width: 100%;
  height: 54px;
  margin-top: 18px;
  box-shadow: 0 7px 18px rgba(8, 120, 238, 0.17);
}

.convert-btn:hover:not(:disabled),
.download-btn:hover {
  background: var(--blue-dark);
}

.convert-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.convert-btn:disabled {
  background: #a7bdd5;
  box-shadow: none;
  cursor: not-allowed;
}

.processing {
  display: none;
  margin-top: 15px;
}

.processing.visible {
  display: block;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #deebfa;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 0.15s ease;
}

#processingText {
  margin: 8px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.message {
  display: none;
  margin-top: 15px;
  padding: 12px 14px;
  border-radius: 10px;
}

.message.visible {
  display: block;
}

.error {
  color: #b42318;
  background: #fff2f2;
  border: 1px solid #ffd0d0;
}

.result {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #cbe4ff;
  border-radius: 15px;
  background: #f1f8ff;
}

.result.visible {
  display: flex;
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-info strong {
  color: var(--blue);
}

.result-info span {
  color: var(--muted);
  font-size: 14px;
}

.download-btn {
  padding: 13px 20px;
  white-space: nowrap;
}

.note {
  margin: 13px 0 0;
  color: #7b90a5;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 620px) {
  .card {
    padding: 18px;
  }

  .header h1 {
    font-size: 28px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .preview.visible {
    grid-template-columns: 1fr;
  }

  .preview img {
    width: 100%;
    height: 170px;
  }

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

  .download-btn {
    width: 100%;
  }
}


.slug-help-field {
  margin-top: 9px;
}

.slug-help {
  color: #7b90a5;
  font-size: 12px;
}
