:root {
  color-scheme: light;
  --paper: #f7f4ec;
  --ink: #292537;
  --muted: #77717e;
  --line: #ded8cc;
  --accent: #67435e;
  --panel: #fffdf7;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
button,
a {
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.45;
}
a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid #ba7294;
  outline-offset: 4px;
}
.masthead {
  margin: 0 4.5%;
  height: 88px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.brand {
  font-size: 26px;
  letter-spacing: -1px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}
.version {
  font: 10px monospace;
  letter-spacing: 1.3px;
  margin-left: 10px;
  color: var(--muted);
}
.mark {
  width: 24px;
  height: 24px;
  background:
    repeating-conic-gradient(var(--accent) 0 25%, transparent 0 50%) 0 / 8px 8px;
}
main {
  margin: 0 auto;
  padding: 0 4.5%;
  max-width: 1600px;
}
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding: 48px 0 42px;
}
.eyebrow,
.field > label,
.upload > span,
.section-heading,
.preview-toolbar {
  font: 10px monospace;
  letter-spacing: 1.5px;
}
.eyebrow {
  color: var(--accent);
  margin: 0 0 18px;
}
h1 {
  font-size: clamp(36px, 4.1vw, 62px);
  font-weight: 500;
  letter-spacing: -2.5px;
  line-height: 1.03;
  margin: 0;
}
h1 em {
  font-family: Georgia, serif;
  font-weight: 400;
  color: var(--accent);
}
.intro-note {
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 3px;
  font-size: 13px;
}
.workspace {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--panel);
}
.controls {
  padding: 25px;
  border-right: 1px solid var(--line);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 27px;
  color: var(--muted);
}
h2 {
  font: 500 18px Arial;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin: 0;
}
.upload {
  border: 1px dashed #bbb0b6;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  position: relative;
  cursor: pointer;
  background: #f6f1ee;
}
.upload strong {
  font-size: 14px;
  font-weight: 500;
}
.upload b {
  float: right;
}
.upload small {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
}
.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  cursor: pointer;
}
.upload:focus-within {
  outline: 3px solid #ba7294;
}
.upload.dragging {
  background: #eadbe3;
}
.text-button {
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--muted);
  font-size: 11px;
  margin-top: 12px;
}
.field {
  margin-top: 27px;
}
.field > label {
  display: block;
  margin-bottom: 12px;
}
.field p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  margin: 10px 0 0;
}
select {
  appearance: none;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 0;
  width: 100%;
  background: var(--panel);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding: 11px 30px 11px 8px;
  color: var(--ink);
  font-size: 13px;
}
.swatches {
  display: flex;
  height: 28px;
  gap: 4px;
  margin-top: 12px;
}
.swatches span {
  flex: 1;
  border: 1px solid #00000015;
}
.range-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.range-row input[type="range"] {
  width: 100%;
  min-width: 30px;
}
.range-row input[type="number"] {
  width: 64px;
  background: transparent;
  border: 1px solid var(--line);
  padding: 5px;
  font: 12px monospace;
}
.range-row > span {
  font-size: 11px;
  color: var(--muted);
}
input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
  margin: 0;
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
.field .check {
  font: 11px Arial;
  letter-spacing: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 12px 0 0;
}
.field .block-label {
  font: 12px Arial;
  letter-spacing: 0;
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.custom-label {
  font-size: 11px;
  margin-top: 12px;
}
.custom-label input {
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  font: 11px monospace;
  border: 1px solid var(--line);
}
[hidden] {
  display: none !important;
}
.preview-area {
  padding: 25px 28px;
  min-width: 0;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  margin-bottom: 26px;
}
.live-dot {
  width: 6px;
  height: 6px;
  background: #678060;
  border-radius: 50%;
}
#sourceName {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50%;
  font: 11px Arial;
  letter-spacing: 0;
}
.previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
figure {
  margin: 0;
  min-width: 0;
}
figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 10px;
}
figcaption span + span {
  font: 10px monospace;
  color: var(--muted);
}
.image-well {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    repeating-conic-gradient(#ebe6dc 0 25%, #f1ede5 0 50%) 0 / 16px 16px;
  padding: 0;
}
.image-well canvas {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  object-fit: contain;
  display: block;
}
#resultCanvas {
  image-rendering: pixelated;
}
.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
}
#status {
  font: 11px monospace;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
#download {
  background: var(--ink);
  color: white;
  padding: 13px 18px;
  border: 0;
  font-size: 12px;
  white-space: nowrap;
}
#download span {
  padding-left: 18px;
}
.error {
  font-size: 12px;
  color: #9b263f;
  background: #f8e3e7;
  padding: 12px;
  line-height: 1.5;
}
.note {
  display: flex;
  gap: 16px;
  margin-top: 35px;
  border-top: 1px solid var(--line);
  padding-top: 25px;
  align-items: center;
}
.note-star {
  font-size: 35px;
  color: var(--accent);
}
.note p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}
.note strong {
  font-weight: 500;
  color: var(--ink);
}
details {
  margin-top: 25px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
summary {
  cursor: pointer;
  font-size: 12px;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
summary::-webkit-details-marker {
  display: none;
}
pre {
  overflow: auto;
  padding: 16px;
  background: #f1ede5;
  font-size: 11px;
  line-height: 1.8;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 25px;
  padding: 24px 0 35px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
}
footer span:first-child {
  color: var(--accent);
}
@media (min-width: 1400px) {
  .controls {
    padding: 30px;
  }
  .workspace {
    grid-template-columns: 300px 1fr;
  }
  .preview-area {
    padding: 30px 35px;
  }
  .image-well {
    aspect-ratio: 1.25;
  }
}
@media (max-width: 950px) {
  .intro-note {
    display: none;
  }
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .controls {
    padding: 20px;
  }
  .preview-area {
    padding: 20px;
  }
  .previews {
    grid-template-columns: 1fr;
  }
  .image-well {
    aspect-ratio: 1.8;
  }
  footer {
    flex-direction: column;
    gap: 4px;
  }
}
@media (max-width: 600px) {
  .masthead {
    height: 68px;
  }
  .version {
    display: none;
  }
  .intro {
    padding: 30px 0;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
  }
  .section-heading {
    grid-column: 1 / -1;
    margin: 0;
  }
  .upload {
    grid-column: 1 / -1;
    padding: 12px;
  }
  .upload small {
    font-size: 11px;
  }
  .text-button {
    margin-top: 0;
    text-align: left;
  }
  .controls > .text-button {
    grid-column: 1 / -1;
  }
  .field {
    margin: 0;
  }
  .field.resolution-field {
    grid-column: 1 / -1;
  }
  .field > label {
    font-size: 9px;
  }
  .preview-toolbar {
    margin-bottom: 18px;
  }
  .previews {
    grid-template-columns: 1fr;
  }
  .image-well {
    aspect-ratio: 1.65;
  }
  h1 {
    letter-spacing: -1.5px;
  }
  .note {
    margin-top: 25px;
  }
  .result-bar {
    gap: 10px;
  }
  #download {
    padding: 12px;
  }
  #status {
    font-size: 10px;
  }
}

.sample-label { display:block; font-size:11px; color:var(--muted); margin:16px 0 8px; }
.photo-credit { display:block; color:var(--muted); font-size:10px; line-height:1.5; margin-top:8px; }
@media(max-width:600px) { .sample-label, #photoSample, .photo-credit { grid-column:1/-1; margin-top:0; } }

.photo-credit:empty { display:none; }

.photo-palette-controls { margin-top: 14px; }
.photo-palette-controls label, .tone-controls label { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12px; margin:14px 0 8px; }
#paletteColors { width:65px; padding:7px; border:1px solid var(--line); background:var(--panel); color:var(--ink); }
#paletteImageInput { max-width:100%; font-size:11px; }
#paletteSourceName { display:block; margin-top:8px; font-size:11px; overflow-wrap:anywhere; color:var(--muted); }
.tone-controls { grid-column:1/-1; }
.tone-controls p { font-size:11px; line-height:1.7; color:var(--muted); }
.swatches { flex-wrap:wrap; height:auto; min-height:28px; }
.swatches span { min-width:8px; min-height:28px; }

.field { min-width:0; }
@media (max-width:600px) {
  .field:has(.photo-palette-controls:not([hidden])) { grid-column:1/-1; }
}
@media (min-width:951px) and (min-height:760px) {
  .preview-area { position:sticky; top:20px; align-self:start; }
}
.site-nav{display:flex;align-items:center;flex-wrap:wrap;gap:22px;font-size:12px}.site-nav a{display:inline-flex;align-items:center;min-height:44px;white-space:nowrap}.recipe-help{font-size:12px;line-height:1.7;color:var(--muted);margin:12px 0}.site-nav a:hover{color:var(--accent)}
@media(max-width:760px){.masthead{flex-wrap:wrap;gap:10px}.site-nav{gap:16px;width:100%}.site-nav a{font-size:11px}.masthead .version{display:none}}
