:root {
  color: #151515;
  background: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
}

main {
  width: min(100% - 32px, 480px);
  margin: 0 auto;
  padding: 56px 0;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  letter-spacing: -0.035em;
}

p {
  margin: 0;
}

form {
  display: grid;
  gap: 22px;
  margin-top: 36px;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  font-size: 0.9rem;
  font-weight: 700;
}

label span,
.muted,
.file-state,
.footnote {
  color: #6b6b6b;
  font-size: 0.82rem;
  line-height: 1.45;
}

label span {
  margin-left: 4px;
  font-weight: 400;
}

input,
button {
  font: inherit;
}

input[type="url"] {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #b9b9b9;
  border-radius: 6px;
  color: inherit;
  background: #fff;
}

input[type="file"] {
  min-width: 0;
  max-width: 100%;
  font-size: 0.85rem;
}

input:focus-visible,
button:focus-visible {
  outline: 3px solid #8bb8ff;
  outline-offset: 2px;
}

input.is-invalid {
  border-color: #bd3838;
}

.field-error {
  color: #b52424;
  font-size: 0.82rem;
  line-height: 1.45;
}

.file-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.file-state {
  overflow-wrap: anywhere;
}

.file-state.is-invalid {
  color: #b52424;
}

.file-state.is-selected {
  color: #202020;
}

.text-button {
  padding: 0;
  cursor: pointer;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: #555;
  font-size: 0.78rem;
}

.size-state {
  color: #1d1d1d;
  font-size: 0.9rem;
  font-weight: 700;
}

.size-state.near-limit {
  color: #8a5200;
}

.size-state.over-limit {
  color: #b52424;
}

.message {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.message.error {
  background: #fff1f1;
  color: #932020;
}

.message.success {
  background: #edfff4;
  color: #17683d;
}

#generate-button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid #151515;
  border-radius: 6px;
  background: #151515;
  color: #fff;
  font-weight: 700;
}

#generate-button:disabled {
  cursor: not-allowed;
  border-color: #d4d4d4;
  background: #d4d4d4;
}

.footnote {
  margin-top: 28px;
}

@media (max-width: 480px) {
  main {
    width: min(100% - 24px, 480px);
    padding: 36px 0;
  }

  .file-control {
    align-items: flex-start;
    flex-direction: column;
  }
}
