:root {
  --red: #bd0926;
  --black: #000000;
  --white: #ffffff;
  --paper: #f5f1eb;
  --panel: #ffffff;
  --line: #ded6cc;
  --muted: #6d665f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--black);
  background: var(--paper);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.header {
  margin-bottom: 16px;
}

.header.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.muted,
.hint,
.subtle {
  color: var(--muted);
}

.hint {
  margin: 0;
  font-size: 12px;
}

.link {
  color: var(--red);
  font-weight: 750;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.start {
  min-height: 100vh;
  display: grid;
  align-content: center;
}

.formatGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.formatButton {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 22px;
  color: var(--black);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.28)),
    linear-gradient(140deg, #cab9a8, #faf7f1 50%, #9d8b7d);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.formatButton:hover,
.formatButton:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(189, 9, 38, 0.42);
  box-shadow: 0 18px 40px rgba(25, 21, 17, 0.12);
  outline: none;
}

.formatButton span {
  font-size: 25px;
  font-weight: 900;
}

.formatButton small {
  color: var(--red);
  font-weight: 800;
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.editor .header {
  grid-column: 1 / -1;
}

.panel {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form {
  display: grid;
  gap: 13px;
}

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

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label {
  font-weight: 760;
}

input[type="text"],
input[type="file"],
textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  color: var(--black);
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

textarea {
  resize: vertical;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.rangeLabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

output {
  color: var(--red);
  font-weight: 850;
}

.btn {
  width: max-content;
  max-width: 100%;
  min-height: 44px;
  padding: 0 18px;
  color: var(--white);
  background: var(--red);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.btn:active {
  transform: translateY(1px);
}

.previewPanel {
  position: sticky;
  top: 16px;
}

.previewWrap,
.resultWrap {
  width: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #eee8df;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.previewWrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.result {
  max-width: 880px;
}

.resultWrap img {
  max-width: 100%;
  height: auto;
  display: block;
}

.actions {
  margin-top: 14px;
}

@media (max-width: 820px) {
  .header.row,
  .formatGrid,
  .editor,
  .split {
    grid-template-columns: 1fr;
  }

  .header.row {
    display: grid;
  }

  .previewPanel {
    position: static;
  }

  .formatButton {
    min-height: 190px;
  }
}
