:root {
  --bg: #f0f0e8;
  --surface: #e8e8e0;
  --ink: #1a1a1a;
  --muted: #686868;
  --accent: #2d5a2d;
  --accent-hover: #3a6a3a;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: Roboto, Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1560px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
}

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

.brandLogo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.socialLinks {
  display: flex;
  gap: 6px;
}

.socialButton {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--bg);
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.socialButton:hover {
  background: var(--ink);
  color: var(--bg);
}

.socialButton:active {
  transform: translate(2px, 2px);
}

.socialButton svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.socialButton span {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: none;
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
  padding-top: 12px;
}

.inputPanel,
.previewPanel,
.toolBar {
  border: 2px solid var(--ink);
  background: var(--surface);
}

.inputPanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

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

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

label {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

textarea,
input {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

input[type="file"] {
  height: auto;
  padding: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

textarea:focus,
input:focus {
  box-shadow: 4px 4px 0 var(--accent);
}

textarea {
  min-height: 177px;
  resize: vertical;
  padding: 10px;
  line-height: 1.35;
}

input {
  height: 40px;
  padding: 0 10px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.fileSummary {
  min-height: 34px;
  border: 2px solid var(--ink);
  background: var(--bg);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.fileSummary.hasFiles {
  color: var(--ink);
}

.toolBar {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(150px, 0.95fr) minmax(130px, 0.75fr) minmax(150px, 0.9fr);
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  padding: 10px 12px;
}

.toolBar .error {
  grid-column: 1 / -1;
}

.compact {
  min-width: 0;
}

.segmentedControl {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: 40px;
  border: 2px solid var(--ink);
}

.segmentedControl input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmentedControl label {
  display: grid;
  place-items: center;
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  text-transform: none;
}

.segmentedControl label + input + label {
  border-left: 2px solid var(--ink);
}

.segmentedControl input:checked + label {
  background: var(--ink);
  color: var(--bg);
}

.button {
  min-height: 40px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.button:hover:not(:disabled) {
  background: var(--ink);
  color: var(--bg);
}

.button:active:not(:disabled) {
  transform: translate(2px, 2px);
}

.button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  color: #f8f8f0;
}

.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #f8f8f0;
}

.error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.error:empty {
  display: none;
}

.previewPanel {
  min-width: 0;
}

.previewPanel,
.canvasWrap,
.emptyState {
  background: var(--bg);
}

.previewHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  border-bottom: 2px solid var(--ink);
  padding: 10px 14px;
}

.previewHeader h2 {
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

.previewHeader span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.canvasWrap {
  position: relative;
  height: min(390px, calc(100dvh - 340px));
  min-height: 260px;
  padding: 12px;
  overflow: auto;
}

canvas {
  display: block;
  width: auto;
  height: auto;
  margin: 0 auto;
  border: 2px solid var(--ink);
  background: #f8f8f0;
  object-fit: contain;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

canvas.isDragging {
  cursor: grabbing;
}

.canvasWrap:not(.hasOutput) canvas {
  display: none;
}

.emptyState {
  position: absolute;
  inset: 20px;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 2px dashed var(--ink);
  text-align: center;
}

.emptyState strong {
  font-size: 22px;
  font-weight: 900;
}

.emptyState span {
  color: var(--muted);
  font-weight: 700;
}

.emptyState.isHidden {
  display: none;
}

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

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

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

  .canvasWrap {
    min-height: 320px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1560px);
    padding: 12px 0;
  }

  .masthead {
    align-items: start;
  }

  .socialLinks {
    gap: 6px;
  }

  .socialButton {
    width: 30px;
    height: 30px;
    border-width: 2px;
  }

  h1 {
    font-size: 34px;
  }

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