:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #171a1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 32px auto;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  background: #ffffff;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  padding: 20px;
  min-width: 0;
}

h1,
h2 {
  margin: 0 0 16px;
  font-weight: 650;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  grid-column: span 2;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.field-wide {
  grid-column: span 12;
}

.field-file {
  grid-column: span 6;
}

input,
select,
button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid #c8ced8;
  padding: 8px 10px;
  font: inherit;
}

button {
  grid-column: span 2;
  border-color: #2458d3;
  background: #2458d3;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.results {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  min-width: 0;
}

.result-preview,
.result-info {
  display: grid;
  align-content: start;
  gap: 16px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.download {
  flex: 0 0 auto;
  color: #2458d3;
  font-weight: 700;
  text-decoration: none;
}

.download.disabled {
  pointer-events: none;
  color: #8a93a3;
}

.preview {
  min-height: 520px;
  max-height: 72vh;
  border: 1px dashed #c8ced8;
  border-radius: 6px;
  display: grid;
  place-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  background: #fbfcfe;
}

.preview svg {
  max-width: 100%;
  max-height: 70vh;
}

pre {
  width: 100%;
  max-width: 100%;
  max-height: 72vh;
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #10151f;
  color: #d7e1f2;
}

@media (max-width: 1040px) {
  .field-wide {
    grid-column: span 12;
  }

  .field {
    grid-column: span 4;
  }

  button {
    grid-column: span 12;
  }

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

  .preview {
    min-height: 360px;
  }
}

@media (max-width: 840px) {
  .form {
    grid-template-columns: 1fr;
  }

  .field,
  .field-wide,
  button {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100vw - 20px, 1280px);
    margin: 16px auto;
  }

  .panel {
    padding: 16px;
  }

  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
