:root {
  color-scheme: light dark;
  --paper: #f6f4ee;
  --surface: #fffefb;
  --sunken: #eeeee5;
  --ink: #253e33;
  --ink-2: #626b60;
  --ink-3: #73796f;
  --line: #e1e3d8;
  --line-strong: #bfc5b7;
  --accent: #a74b2d;
  --accent-ink: #ffffff;
  --accent-wash: #f7ebe2;
  --ok: #356e4c;
  --err: #b23832;
  --radius: 22px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px -24px rgba(37, 62, 51, 0.18);
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #19231f;
    --surface: #222e27;
    --sunken: #2b382f;
    --ink: #f2f0e5;
    --ink-2: #bdc7b9;
    --ink-3: #a2af9e;
    --line: #3b493d;
    --line-strong: #657460;
    --accent: #efad86;
    --accent-ink: #2a251e;
    --accent-wash: #3d3329;
    --ok: #a1cfab;
    --err: #ffa79a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45),
      0 14px 30px -18px rgba(0, 0, 0, 0.85);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100dvh; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------------ chrome */
.topbar {
  background: var(--paper);
  padding-top: env(safe-area-inset-top);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.3rem 1rem;
}

.mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
}

.brand-home {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.15s;
}
.brand-home:hover h1 { color: var(--accent); }
.brand-text { min-width: 0; flex: 1; }
.brand h1 { font-size: 0.95rem; margin: 0; letter-spacing: -0.03em; }
.subtitle { margin: 0.1rem 0 0; color: var(--ink-2); font-size: 0.78rem; }

.studio-note { display: none; color: var(--ink-2); font-size: 0.78rem; }

/* Language switcher: compact chips beside the stepper, aria-pressed follows
   the active language the same way view chips do. */
.lang-switch {
  display: flex;
  gap: 0.25rem;
  padding: 0.35rem 1rem 0.1rem;
}
.lang-switch .lang {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  min-height: calc(var(--tap) - 0.6rem);
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lang-switch .lang:hover { border-color: var(--accent); color: var(--accent); }
.lang-switch .lang[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
}

.steps {
  display: flex;
  gap: 0;
  margin: 0 0.85rem;
  padding: 0.4rem 0;
  border-block: 1px solid var(--line);
}
.steps::-webkit-scrollbar { display: none; }

.step {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  border-radius: 8px;
  padding: 0.6rem 0.2rem;
  min-height: var(--tap);
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.step-num {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 0.7rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.step[aria-current="step"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
  font-weight: 600;
}
.step[aria-current="step"] .step-num { background: var(--accent); color: var(--accent-ink); }

.step.is-done { color: var(--ink-2); border-color: var(--line-strong); }
.step.is-done .step-num { background: var(--ink); color: var(--paper); }
.step:disabled { opacity: 1; color: var(--ink-3); }

/* ------------------------------------------------------------------- panel */
main { padding: 1rem 0.85rem 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.1rem, 3vw, 2.5rem);
  margin-bottom: 1rem;
}

.panel-head { margin-bottom: 1.5rem; }
.panel h2 { margin: 0 0 0.75rem; font: 400 clamp(1.9rem, 3.8vw, 3.2rem)/1.1 Georgia, "Times New Roman", serif; letter-spacing: -0.045em; text-wrap: balance; }
.panel h2:focus { outline: none; }
.eyebrow { margin: 0 0 1rem; font-size: 0.65rem; font-weight: 650; letter-spacing: 0.16em; color: var(--ink-2); }
.hint { color: var(--ink-2); font-size: 0.83rem; line-height: 1.45; margin: 0; }

label { display: block; margin: 0.75rem 0; font-size: 0.9rem; font-weight: 500; }
select, input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field { border: 0; padding: 0; margin: 0.4rem 0 0.2rem; }
.field legend { font-size: 0.9rem; font-weight: 500; padding: 0; margin-bottom: 0.4rem; }

.actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

button.primary, button.secondary {
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  min-height: var(--tap);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  flex: 1;
  transition: background 0.15s, transform 0.15s;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent), var(--ink) 12%); transform: translateY(-1px); }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover:not(:disabled) { background: var(--sunken); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.status { margin-top: 0.7rem; font-size: 0.85rem; color: var(--ink-2); min-height: 1.2em; }
.status.error { color: var(--err); }
.status.ok { color: var(--ok); }

.upload-progress { margin: 0.4rem 0 0; }
.progress-text { font-size: 0.8rem; color: var(--ink-2); min-height: 1.1em; }
.progress-text:empty { display: none; }
.upload-progress .progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.3s ease;
}
.upload-progress.is-indeterminate .progress-bar {
  width: 35%;
  animation: upload-indeterminate 1.2s ease-in-out infinite;
}
@keyframes upload-indeterminate {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

/* ------------------------------------------------------------------ upload */
.dropzone {
  display: grid;
  place-items: center;
  gap: 0.15rem;
  text-align: center;
  padding: 1.7rem 0.8rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.is-dragover { border-color: var(--accent); background: var(--accent-wash); }
.dropzone-icon { color: var(--accent); width: 44px; height: 44px; margin-bottom: 0.4rem; }
.file-types { margin-top: 0.8rem; font-size: 0.65rem; letter-spacing: 0.06em; color: var(--ink-3); }
.dropzone-title { margin: 0.45rem 0 0; font-weight: 600; color: var(--ink); }
.dropzone-sub { margin: 0.1rem 0 0; font-size: 0.8rem; }

.upload-actions { display: flex; gap: 0.55rem; margin-top: 0.9rem; }

.photo-preview {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--sunken);
}
.photo-preview img { display: block; width: 100%; max-height: 40vh; object-fit: contain; }
.photo-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.78rem;
  color: var(--ink-2);
  border-top: 1px solid var(--line);
}
#photo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------------- crop */
.crop-layout { display: flex; flex-direction: column; gap: 0.85rem; }
.crop-stage {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  overscroll-behavior: contain;
}
#crop-canvas { display: block; max-width: 100%; height: auto; touch-action: none; cursor: grab; }
#crop-canvas:active { cursor: grabbing; }

.crop-controls { display: flex; flex-direction: column; gap: 0.15rem; }

.zoom-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}
.icon-btn {
  flex: 0 0 auto;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--sunken); }

#zoom-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  accent-color: var(--accent);
}
#zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
#zoom-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  cursor: pointer;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.5rem; }
.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  min-height: var(--tap);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------- settings */
.segmented { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.segmented button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  min-height: var(--tap);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.segmented button[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

label.checkbox { display: flex; align-items: center; gap: 0.6rem; }
label.checkbox input { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; accent-color: var(--accent); }
.face-option small, .field-hint { display: block; margin-top: 0.2rem; color: var(--ink-2); font-size: 0.78rem; font-weight: 400; }

.advanced { margin-top: 0.9rem; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.advanced summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
  padding: 0.4rem 0;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "+ "; color: var(--accent); }
.advanced[open] summary::before { content: "− "; }

/* ------------------------------------------------------------------ result */
.progress {
  height: 8px;
  background: var(--sunken);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.7rem 0;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.3s ease;
}

.view-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.7rem 0; }
.view-chips button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: var(--tap);
  font-size: 0.83rem;
  font-family: inherit;
  cursor: pointer;
}
.view-chips button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

.result-frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--sunken);
}
/* svh, not dvh: dvh follows the phone toolbar as it slides away on scroll, so
   the preview grew and shrank while the page scrolled. vh is the fallback. */
#result-image {
  display: block; width: auto; max-width: 100%; height: auto;
  max-height: max(280px, calc(100vh - 18rem));
  max-height: max(280px, calc(100svh - 18rem));
}
.result-image-link { display: block; cursor: zoom-in; }

/* WYSIWYG mute feedback: the pending (not-yet-regenerated) muted colours are
   painted grey on top of the current preview. It clears itself once a
   regeneration applies the suppression, so the finished sheet is never grey. */
.mute-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.result-stats { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.result-stats .stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  color: var(--ink-2);
}
.result-stats .stat b { color: var(--ink); font-size: 0.9rem; }

.downloads { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.downloads a {
  flex: 1 1 45%;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  min-height: var(--tap);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.downloads a:hover { background: var(--accent-wash); }
.downloads a.is-primary { background: var(--accent); color: var(--accent-ink); }
.downloads a.is-primary:hover { background: color-mix(in srgb, var(--accent), var(--ink) 12%); }

.result-layout { display: grid; gap: 1rem; }
.result-main { min-width: 0; }
.palette {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr));
  align-content: start;
  gap: 0.4rem;
}
.palette .swatch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 2.25rem;
  padding: 0.2rem 0.6rem 0.2rem 0.25rem;
}
.palette button.swatch { min-height: var(--tap); }
.palette .chip-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Colour removal (currently unavailable; hidden by the server flag) */
.colour-removal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0;
}
.colour-removal .hint { flex: 1 1 100%; }
button.swatch {
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}
button.swatch:hover { border-color: var(--accent); }
.palette .swatch.is-muted { opacity: 0.55; }
.palette .swatch.is-muted .chip-swatch {
  background: var(--ink-2) !important;
  filter: grayscale(1);
}
.palette .swatch.is-muted::after {
  content: "✕";
  color: var(--danger, #b3261e);
  font-size: 0.72rem;
}
/* A muted colour that left the regenerated palette: still visible so it can be
   restored, marked as no longer part of the sheet. */
.palette .swatch.is-orphan {
  border-style: dashed;
  opacity: 0.75;
}
.palette .swatch.is-orphan .chip-swatch {
  background: var(--ink-2) !important;
  filter: grayscale(1);
}
#result-image.is-mutable { cursor: zoom-in; }

.info-dialog {
  box-sizing: border-box;
  width: min(26rem, calc(100vw - 2rem));
  max-width: 26rem;
  overflow-x: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 1.1rem 1.2rem;
}
.info-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.info-dialog h3 { margin: 0 0 0.5rem; }
.info-dialog ol { margin: 0.5rem 0 1rem; padding-left: 1.2rem; font-size: 0.86rem; }
.info-dialog li { margin-bottom: 0.35rem; }
/* Long button labels must wrap inside the dialog instead of overflowing its
   left edge (the desktop .actions rule right-aligns fixed-width buttons). */
.info-dialog .actions { flex-wrap: wrap; }
.info-dialog .actions button { flex: 1 1 auto; white-space: normal; }

.hidden { display: none !important; }
[hidden] { display: none !important; }

/* The studio illustration is inline SVG: no fonts, image downloads or runtime. */
.skip-link { position: absolute; top: -100px; left: 1rem; z-index: 30; padding: 0.8rem 1rem; background: var(--ink); color: var(--paper); border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.photo-panel { padding: 0; overflow: hidden; }
.photo-workspace { min-width: 0; padding: 1.5rem; }
.photo-panel h2 { font-size: clamp(2.2rem, 4.1vw, 3.6rem); }
.photo-panel h2 em { color: var(--accent); font-weight: 400; }
.intro { max-width: 27rem; line-height: 1.7; }
.upload-actions > button { flex: 1; min-width: 0; font-size: 0.85rem; }
.upload-actions .primary { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.photo-next:has(button:disabled) { display: none; }
@media (hover: hover) and (pointer: fine) {
  #pick-camera { display: none; }
}
.status:empty { display: none; }
/* Hero image of the photo step: the shipped parrot proposal, shown on phones too. */
.studio-preview { padding: 1.2rem 1.5rem; background: var(--sunken); border-top: 1px solid var(--line); }
.preview-heading { margin-bottom: 0.9rem; color: var(--ink-2); font-size: 0.6rem; letter-spacing: 0.16em; }
.preview-note { margin: 0.65rem 0 0; color: var(--ink-2); font-size: 0.7rem; }
.hero-art { width: 100%; width: min(100%, 30rem); height: auto; display: block; background: #fffdf6; box-shadow: 0 10px 22px -14px #253e3366; }
.studio-benefits { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; border-top: 1px solid var(--line); padding: 1rem 1.5rem; color: var(--ink-2); font-size: 0.7rem; }
.studio-benefits b { color: var(--accent); margin-right: 0.35rem; font-size: 0.65rem; }
.studio-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem; padding: 0.5rem 1rem; color: var(--ink-3); font-size: 0.67rem; }
.palette-card { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.palette-card .eyebrow { margin-bottom: 0.8rem; }
.crop-controls { min-width: 0; padding: 0.5rem; }
.crop-stage { min-width: 0; }
.result-main { min-width: 0; }
.panel[data-panel="settings"] { max-width: 760px; margin-inline: auto; }
.panel[data-panel="settings"] > .checkbox { padding: 1rem; background: var(--sunken); border-radius: var(--radius-sm); margin-block: 1.5rem; }
.segmented button { border-radius: 10px; flex: 1 1 auto; }
/* Card 6abb48f2: the difficulty chips sit on a centred grid of equal cells
   instead of wrapping by label width. Phones get two columns with the fifth
   chip (bardzo trudny) centred under them, mid widths a 3 + 2 layout with the
   second row centred, desktop one row of five — every chip is the same width
   and none spans the whole row. */
#difficulty-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
#difficulty-chips button { grid-column: span 2; min-width: 0; padding-inline: 0.5rem; text-align: center; text-wrap: balance; }
#difficulty-chips button:last-child { grid-column: 2 / span 2; }
@media (min-width: 480px) {
  #difficulty-chips { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #difficulty-chips button:nth-child(4) { grid-column: 2 / span 2; }
  #difficulty-chips button:last-child { grid-column: span 2; }
}
@media (min-width: 720px) {
  #difficulty-chips { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #difficulty-chips button:nth-child(n) { grid-column: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .panel { animation: arrive 180ms ease-out; }
  @keyframes arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ desktop */
@media (min-width: 720px) {
  main { padding: 2rem 1.5rem 0; }
  .brand { padding: 1.6rem 1.5rem; }
  .studio-note { display: block; }
  .steps { margin-inline: 1.5rem; padding-block: 0.6rem; }
  .step { font-size: 0.8rem; gap: 0.6rem; }
  .step-num { width: 1.7rem; height: 1.7rem; }
  .crop-layout { flex-direction: row; align-items: flex-start; }
  .crop-stage { flex: 2; }
  #crop-canvas { max-height: max(220px, calc(100vh - 29rem)); max-height: max(220px, calc(100svh - 29rem)); }
  .crop-controls { flex: 1; }
  .upload-actions { max-width: none; }
  .actions { justify-content: flex-end; }
  button.primary, button.secondary { flex: 0 0 auto; min-width: 9rem; }
  .upload-actions > button { flex: 1; }
  #to-crop { min-width: 100%; }
  .downloads a { flex: 0 0 auto; }
  .result-layout { grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem); align-items: start; }
  .result-layout .palette { margin-top: 0; justify-content: flex-start; }
  .studio-footer { padding-inline: 1.5rem; }
}

@media (min-width: 960px) {
  .photo-panel { display: grid; grid-template-columns: 1.12fr 1fr; }
  .photo-workspace { padding: 2.5rem 3rem; }
  .studio-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.8rem 2.6rem; border-top: 0; border-left: 1px solid var(--line); }
  .preview-heading { display: flex; justify-content: space-between; width: 100%; margin-bottom: 1.1rem; }
  .hero-art { width: min(100%, 24rem); box-shadow: 0 10px 25px -15px #253e3366; }
  .studio-benefits { grid-column: 1 / -1; padding: 1.3rem 3rem; }
}
