:root {
  --bg: #e6e1d6;
  --card: #f6f3ec;
  --ink: #1b1916;
  --muted: #5c564d;
  --line: #1b1916;
  --soft: #b7b1a6;
  --focus: #1d4ed8;
  --danger: #9f1239;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 ui-sans-serif, system-ui, sans-serif;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

h1,
h2,
legend {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-weight: 600;
}

h1 {
  margin: 0 0 8px;
  font-size: 2.5rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

header p {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 20px;
  align-items: start;
  margin-top: 28px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 20px;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--soft);
}

legend {
  padding: 0 6px;
  font-size: 1.15rem;
}

label,
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 650;
}

.hint,
.download-note,
#status {
  color: var(--muted);
  font-weight: 450;
}

.download-note {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

textarea,
select,
input[type="number"],
input[type="file"],
input[type="color"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--soft);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 450;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input[type="color"] {
  padding: 6px;
}

input[type="file"] {
  padding: 10px;
  font-weight: 450;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--ink);
}

.field:has(input:disabled) {
  opacity: 0.45;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.range-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.range-label label {
  font-size: inherit;
}

output {
  color: var(--muted);
  font-weight: 450;
}

.logo-chosen {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-chosen img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--soft);
}

#logo-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 450;
}

button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 2px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button.primary {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
}

button.secondary {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.preview-frame {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 16px;
  background:
    linear-gradient(45deg, #efece4 25%, transparent 25%),
    linear-gradient(-45deg, #efece4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #efece4 75%),
    linear-gradient(-45deg, transparent 75%, #efece4 75%);
  background-color: #fbfaf7;
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border: 1px dashed var(--soft);
}

.qr-host {
  width: min(100%, 320px);
  background: #fff;
}

.qr-host svg {
  display: block;
  width: 100%;
  height: auto;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.actions button {
  flex: 1;
}

#status {
  min-height: 3.2em;
  margin: 12px 0 0;
}

#status.is-warn {
  color: var(--danger);
}

noscript {
  display: block;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 24px;
}

@media (min-width: 801px) {
  .layout > section {
    position: sticky;
    top: 20px;
  }
}

@media (max-width: 800px) {
  .layout,
  .row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .logo-chosen {
    flex-wrap: wrap;
  }
}
