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

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  line-height: 1.5;
  color: #212121;
  background: linear-gradient(to top right, #f4f4f4 50%, #ffffff 50%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 24px 0;
}

button, input, label {
  font-family: inherit;
  font-size: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* layout */
#app {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

/* title */
.title {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 800;
  color: #ff5c8d;
  margin-bottom: 16px;
  letter-spacing: -1px;
  line-height: 1.1;
}

/* description */
.description {
  font-size: 0.95rem;
  color: #8e8e8e;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* disclaimer */
.disclaimer {
  width: 100%;
  text-align: center;
  margin-top: auto;
  padding: 16px 24px;
  font-size: 0.75rem;
  color: #b0b0b0;
  line-height: 1.5;
}

/* error */
.error {
  color: #c0392b;
  font-size: 0.95rem;
  background: #ffebee;
  border: 2.5px solid #c0392b;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 3px 3px 0 #c0392b;
}

/* form */
.upload-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: transparent;
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
}

#file-input {
  display: none;
}

.file-label {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  background: #e1306c;
  color: #fff;
  border: 2.5px solid #212121;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #212121;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.file-label:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #212121;
}

.file-label:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #212121;
}

.change-label {
  display: inline-block;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #833ab4;
  background: #fff;
  border: 2.5px solid #212121;
  border-radius: 12px;
  box-shadow: 3px 3px 0 #212121;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.change-label:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #212121;
}

.change-label:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #212121;
}

.preview {
  max-height: 30vh;
  max-width: 90vw;
  border-radius: 16px;
  border: 2.5px solid #212121;
  box-shadow: 4px 4px 0 #212121;
  object-fit: contain;
}

button.file-label {
  background: #f77737;
  border: 2.5px solid #212121;
}

button.file-label:disabled {
  background: #e0e0e0;
  color: #9e9e9e;
  box-shadow: 4px 4px 0 #bdbdbd;
  border-color: #bdbdbd;
  cursor: not-allowed;
  transform: none;
}

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

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 0;
}

.loader__spinner {
  width: 64px;
  height: 64px;
  border: 5px solid #f0d0d8;
  border-top-color: #e1306c;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader__text {
  font-size: 1rem;
  font-weight: 700;
  color: #e1306c;
  animation: pulse-text 1.6s ease-in-out infinite;
}

/* download button */
.download-btn {
  text-decoration: none;
  display: inline-block;
}

/* result image square crop */
.result-image {
  width: min(320px, 90vw);
  height: min(320px, 90vw);
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  border: 2.5px solid #212121;
  box-shadow: 4px 4px 0 #212121;
}

/* result */
.result {
  background: #fff;
  border: 2.5px solid #212121;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #212121;
  padding: 16px;
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  width: 100%;
}

/* tablet and up */
@media (min-width: 600px) {
  .upload-form {
    padding: 40px 40px;
  }

  .file-label,
  button {
    width: auto;
    min-width: 220px;
  }
}
