:root {
  color-scheme: dark;
  --ink: #111712;
  --ink-soft: #171e19;
  --panel: #1a231d;
  --panel-raised: #202b24;
  --line: rgba(225, 239, 221, 0.12);
  --line-strong: rgba(225, 239, 221, 0.22);
  --paper: #f2f2e9;
  --muted: #a0aea2;
  --faint: #929e93;
  --acid: #d5ff62;
  --blue: #9bc3ff;
  --coral: #ff9384;
  --radius: 20px;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(ellipse at 12% 0%, rgba(93, 125, 91, 0.16), transparent 38rem),
    radial-gradient(ellipse at 92% 19%, rgba(61, 87, 123, 0.12), transparent 34rem),
    var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

.shell {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 0 clamp(18px, 4.1vw, 64px);
}

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--paper);
  font: 600 12px var(--mono);
  letter-spacing: 0.13em;
  text-decoration: none;
}

.mark {
  display: grid;
  width: 24px;
  height: 24px;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  transform: rotate(-8deg);
}

.mark i {
  border: 1px solid var(--acid);
  border-radius: 3px;
  background: rgba(213, 255, 98, 0.13);
}

.mark i:nth-child(2) {
  background: var(--acid);
}

.mark i:nth-child(3) {
  opacity: 0.5;
}

.local-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c9d4c8;
  font: 9px var(--mono);
  letter-spacing: 0.08em;
}

.local-dot,
.processing-pulse {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 12px rgba(213, 255, 98, 0.48);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.65fr);
  align-items: end;
  gap: 40px;
  padding: clamp(54px, 8vw, 108px) 0 48px;
}

.eyebrow,
.panel-kicker,
.studio-label,
.step-number,
.panel-state,
.processing-line,
.image-side figcaption,
.readout-label,
.readout-stats > div > span,
.palette-label,
.palette-count,
.format-tag,
.range-ends,
.footer {
  font-family: var(--mono);
  letter-spacing: 0.09em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 23px;
  color: var(--acid);
  font-size: 9px;
}

.eyebrow-line {
  width: 25px;
  height: 1px;
  background: currentColor;
}

.intro h1 {
  margin: 0;
  font-size: clamp(58px, 8vw, 106px);
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 0.89;
}

.intro h1 em {
  color: var(--acid);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.07em;
}

.lede {
  max-width: 360px;
  margin: 0 0 7px auto;
  color: #bdc8bd;
  font-size: clamp(15px, 1.45vw, 18px);
  line-height: 1.65;
}

.studio-label {
  display: flex;
  justify-content: space-between;
  padding: 0 1px 12px;
  color: var(--faint);
  font-size: 9px;
}

.studio-label span:first-child {
  color: #ced8ce;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(285px, 350px) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 15px;
  align-items: start;
}

.surface {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 58%), var(--ink-soft);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.1);
}

.source-panel {
  grid-column: 1;
  grid-row: 1;
  padding: 19px;
}

.controls-panel {
  grid-column: 1;
  grid-row: 2;
  padding: 19px;
}

.preview-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: clamp(16px, 2.1vw, 27px);
}

.panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.step-number {
  display: grid;
  width: 31px;
  height: 31px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--acid);
  font-size: 10px;
}

.panel-kicker {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 8px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.panel-state {
  margin-left: auto;
  color: var(--faint);
  font-size: 8px;
}

.drop-zone {
  position: relative;
  display: flex;
  min-height: 166px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 18px;
  overflow: hidden;
  border: 1px dashed rgba(213, 255, 98, 0.38);
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 0%, rgba(213, 255, 98, 0.09), transparent 72%),
    rgba(8, 13, 10, 0.28);
  cursor: pointer;
  color: inherit;
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--acid);
  background-color: rgba(213, 255, 98, 0.055);
}

.drop-zone:active {
  transform: scale(0.99);
}

.drop-zone:focus-within {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.upload-glyph {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 1px solid rgba(213, 255, 98, 0.3);
  border-radius: 12px;
  color: var(--acid);
  background: rgba(213, 255, 98, 0.06);
}

.upload-glyph svg {
  width: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.drop-title {
  font-size: 13px;
  font-weight: 600;
}

.drop-detail {
  color: #c0cbbf;
  font-size: 10px;
}

.drop-limit {
  margin-top: 3px;
  color: var(--faint);
  font: 9px var(--mono);
}

.file-summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 13, 10, 0.28);
}

.file-mark {
  display: grid;
  width: 31px;
  height: 31px;
  flex: none;
  place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: rgba(155, 195, 255, 0.1);
}

.file-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.file-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy span {
  color: var(--muted);
  font: 9px var(--mono);
}

.text-button {
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  color: var(--acid);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 13px 1px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.privacy-note svg {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 1px;
  stroke: var(--acid);
  stroke-width: 1.25;
}

.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 17px;
}

.transparency-note {
  margin: -8px 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 10, 0.35);
}

.view-switch button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.view-switch button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--acid);
  font-weight: 650;
}

.processing-line {
  display: flex;
  min-height: 33px;
  align-items: center;
  gap: 9px;
  color: #d5dfd5;
  font-size: 9px;
  letter-spacing: 0.035em;
}

.processing-line p {
  min-width: 0;
  flex: 1;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-line > span:last-child {
  color: var(--faint);
  font-size: 8px;
}

.processing-action {
  min-height: 30px;
  flex: none;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--paper);
  background: var(--panel-raised);
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
}

.processing-action:focus-visible,
.mobile-cancel:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}

.processing-pulse[data-active="true"] {
  animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
  to { opacity: 0.34; transform: scale(0.7); }
}

progress {
  display: block;
  width: 100%;
  height: 3px;
  margin: 0 0 12px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  accent-color: var(--acid);
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.07);
}

progress::-webkit-progress-value {
  border-radius: 3px;
  background: var(--acid);
}

progress::-moz-progress-bar {
  border-radius: 3px;
  background: var(--acid);
}

.error-message {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 147, 132, 0.28);
  border-radius: 10px;
  color: #ffc2b9;
  background: rgba(255, 147, 132, 0.07);
  font-size: 11px;
  line-height: 1.45;
}

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

.image-side {
  min-width: 0;
  margin: 0;
}

.comparison[data-view="folded"] .original-side,
.comparison[data-view="original"] .folded-side {
  display: none;
}

.comparison[data-view="folded"] .folded-side,
.comparison[data-view="original"] .original-side {
  grid-column: 1 / -1;
}

.image-frame {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 290px;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(124, 151, 120, 0.14), transparent 70%),
    #141b16;
}

.folded-frame {
  background-color: #171e19;
  background-image:
    linear-gradient(45deg, rgba(231, 241, 230, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(231, 241, 230, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(231, 241, 230, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(231, 241, 230, 0.035) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

/* Neutral, contrasting squares make transparent dark or light artwork visible. */
.image-frame.alpha-checker,
.inspect-viewport.alpha-checker {
  background-color: #e4e5e2;
  background-image:
    linear-gradient(45deg, #a4aaa6 25%, transparent 25%),
    linear-gradient(-45deg, #a4aaa6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #a4aaa6 75%),
    linear-gradient(-45deg, transparent 75%, #a4aaa6 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.image-frame canvas,
.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-frame img {
  position: absolute;
  inset: 0;
}

.image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 19px;
  color: #c4d0c4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, 2vw, 23px);
  line-height: 1.3;
  text-align: center;
}

.folded-placeholder {
  color: #e5ecd9;
}

.placeholder-mark {
  color: var(--acid);
  font: 9px var(--mono);
  letter-spacing: 0.1em;
}

.folded-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--acid);
  background: rgba(17, 23, 18, 0.58);
  font: 10px var(--mono);
}

.image-side figcaption {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 2px 0;
  color: #d2ddd2;
  font-size: 8px;
}

.image-side figcaption > span:first-child {
  color: var(--acid);
}

.figure-meta {
  margin-left: auto;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.03em;
}

.inspect-trigger {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font: 8px var(--mono);
  letter-spacing: 0.04em;
}

.inspect-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  color: var(--paper);
  background: var(--ink);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
}

.inspect-dialog[open] {
  display: grid;
}

.inspect-dialog::backdrop {
  background: rgba(6, 9, 7, 0.88);
}

.inspect-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.inspect-header .panel-kicker {
  margin: 0 0 5px;
  color: var(--acid);
  font-size: 8px;
}

.inspect-header h2 {
  margin: 0;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.inspect-dimensions {
  margin: 5px 0 0;
  color: var(--muted);
  font: 10px var(--mono);
}

.inspect-close {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.inspect-scale {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.inspect-scale button {
  min-width: 94px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
  font-size: 11px;
}

.inspect-scale button[aria-pressed="true"] {
  border-color: var(--acid);
  color: var(--ink);
  background: var(--acid);
  font-weight: 650;
}

.inspect-viewport {
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background-color: #171e19;
  background-image:
    linear-gradient(45deg, rgba(231, 241, 230, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(231, 241, 230, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(231, 241, 230, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(231, 241, 230, 0.035) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  touch-action: pan-x pan-y;
}

.inspect-viewport[data-scale="actual"] {
  display: block;
}

.inspect-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.inspect-viewport[data-scale="actual"] .inspect-image {
  max-width: none;
  max-height: none;
}

.inspect-scale-status {
  max-width: 44rem;
  margin: 0;
  color: var(--muted);
  font: 9px var(--mono);
  line-height: 1.5;
  text-align: center;
}

.delivery-readout {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(0, 2fr);
  gap: 17px;
  margin-top: 22px;
  padding: 17px 0 0;
  border-top: 1px solid var(--line);
}

.delivery-lead {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.readout-label {
  color: var(--faint);
  font-size: 8px;
}

.delivery-lead strong {
  color: var(--acid);
  font: 500 clamp(15px, 1.7vw, 21px) var(--mono);
  letter-spacing: -0.06em;
}

.delivery-lead[data-state="over"] strong {
  color: var(--coral);
}

.readout-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.readout-stats > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.readout-stats > div > span {
  color: var(--faint);
  font-size: 8px;
}

.readout-stats strong {
  overflow: hidden;
  color: var(--paper);
  font: 500 13px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readout-exact {
  color: var(--muted);
  font: 9px var(--mono);
  line-height: 1.2;
  white-space: nowrap;
}

.palette-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.palette-label,
.palette-count {
  color: var(--faint);
  font-size: 8px;
}

.swatches {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
  gap: 5px;
}

.swatch {
  position: relative;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
}

.swatch[title]:hover::after {
  position: absolute;
  z-index: 3;
  bottom: 27px;
  left: 50%;
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--paper);
  background: var(--ink);
  content: attr(title);
  font: 9px var(--mono);
  transform: translateX(-50%);
}

.controls-panel > .panel-heading {
  margin-bottom: 17px;
}

.control-block {
  min-width: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.control-block > label,
.range-heading label {
  display: block;
  color: #e5ece3;
  font-size: 11px;
  font-weight: 570;
}

.profile-control-heading {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-control-heading > label {
  display: block;
  color: #e5ece3;
  font-size: 11px;
  font-weight: 570;
}

.restore-profile {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--paper);
  background: #151c17;
  font-size: 10px;
  cursor: pointer;
}

.restore-profile:hover:not(:disabled) {
  border-color: var(--acid);
  color: var(--acid);
}

.restore-profile:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.control-block select {
  width: 100%;
  min-height: 43px;
  margin-top: 9px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--paper);
  background-color: #151c17;
  font-size: 11px;
}

.custom-budget-control {
  margin-top: 12px;
}

.custom-budget-control[hidden] {
  display: none;
}

.custom-budget-control > label {
  display: block;
  color: #e5ece3;
  font-size: 10px;
  font-weight: 570;
}

.custom-budget-entry {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}

.custom-budget-entry input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--paper);
  background: #151c17;
  font: 12px var(--mono);
}

.custom-budget-entry span {
  color: var(--muted);
  font: 9px var(--mono);
}

.control-block select:disabled,
.control-block input:disabled {
  opacity: 0.5;
}

.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

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

.range-heading output {
  color: var(--acid);
  font: 10px var(--mono);
}

.control-block input[type="range"] {
  width: 100%;
  height: 27px;
  margin: 9px 0 0;
  accent-color: var(--acid);
  cursor: pointer;
  touch-action: pan-y;
}

.range-ends {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 7px;
}

.control-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
}

.control-pair .control-block {
  border-top: 0;
}

.format-tag {
  color: var(--blue);
  font-size: 7px;
}

.quality-block {
  padding-bottom: 13px;
}

.action-row {
  display: flex;
  gap: 9px;
  margin-top: 5px;
}

.small-preview-export {
  display: grid;
  gap: 3px;
  margin-top: 8px;
}

.small-preview-button {
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--paper);
  background: var(--panel-raised);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 620;
  text-align: left;
}

.small-preview-button:hover:not(:disabled) {
  border-color: var(--muted);
  background: var(--panel);
}

.small-preview-button:disabled {
  color: var(--faint);
  cursor: not-allowed;
}

.small-preview-export .field-note {
  display: block;
  margin: 0;
}

.download-button {
  display: flex;
  min-height: 51px;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px;
  border: 0;
  border-radius: 12px;
  color: #172012;
  background: var(--acid);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  transition: filter 150ms ease, transform 150ms ease;
}

.download-button:not(:disabled):hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.download-button:disabled {
  color: #8b9687;
  background: #303a31;
  cursor: not-allowed;
}

.download-button span:last-child {
  font-size: 18px;
}

.clear-button {
  width: 51px;
  min-width: 51px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.clear-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.export-note {
  margin: 11px 1px 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.55;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 32px;
  padding: 18px 1px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 8px;
}

.footer i {
  color: var(--acid);
  font-style: normal;
}

@media (max-width: 940px) {
  .workspace {
    grid-template-columns: minmax(270px, 315px) minmax(0, 1fr);
  }

  .delivery-readout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding-right: 17px;
    padding-left: 17px;
  }

  .topbar {
    min-height: 64px;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding: 52px 0 34px;
  }

  .intro h1 {
    font-size: clamp(58px, 14vw, 86px);
  }

  .lede {
    max-width: 420px;
    margin: 0;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  .source-panel,
  .preview-panel,
  .controls-panel {
    grid-column: 1;
  }

  .source-panel {
    grid-row: 1;
    padding: 15px;
  }

  .preview-panel {
    grid-row: 2;
    padding: 15px;
  }

  .controls-panel {
    grid-row: 3;
    padding: 15px;
  }

  .drop-zone {
    min-height: 144px;
  }

  .view-switch {
    gap: 1px;
  }

  .view-switch button {
    min-height: 38px;
    padding: 0 9px;
    font-size: 9px;
  }

  .comparison {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .image-frame {
    min-height: 0;
    max-height: 62svh;
    aspect-ratio: 4 / 3;
  }

  .delivery-readout {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr);
    gap: 12px;
  }

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

  .control-block select {
    min-height: 48px;
    font-size: 14px;
  }

  .control-block > label,
  .range-heading label {
    font-size: 13px;
  }

  .control-block input[type="range"] {
    height: 34px;
  }

  .footer {
    margin-top: 20px;
    font-size: 7px;
  }
}

@media (max-width: 390px) {
  .shell {
    padding-right: 13px;
    padding-left: 13px;
  }

  .local-badge {
    min-height: 30px;
    padding: 0 9px;
    font-size: 8px;
  }

  .intro h1 {
    font-size: 57px;
  }

  .studio-label {
    gap: 12px;
    font-size: 7px;
  }

  .preview-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-switch {
    width: 100%;
  }

  .view-switch button {
    flex: 1;
  }

  .delivery-readout {
    grid-template-columns: minmax(0, 1fr);
  }

  .delivery-lead {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* The studio behaves like an app: the workspace owns the viewport. */
html,
body {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: grid;
  width: min(100%, 1760px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  grid-template-rows: 56px minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
}

.intro,
.studio-label,
.footer {
  display: none;
}

.topbar {
  min-height: 0;
}

.open-image-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 11px;
  font-weight: 550;
}

.open-image-button svg {
  width: 17px;
  height: 17px;
  stroke: var(--acid);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace {
  min-height: 0;
  grid-template-columns: minmax(210px, 0.76fr) minmax(0, 1.8fr) minmax(285px, 0.96fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  overflow: hidden;
}

.surface {
  min-height: 0;
  overflow: hidden;
  border-radius: 17px;
}

.source-panel,
.preview-panel,
.controls-panel {
  grid-row: 1;
  padding: 15px;
}

.source-panel { grid-column: 1; }
.preview-panel { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; }
.controls-panel { grid-column: 3; grid-row: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

.panel-heading { gap: 9px; }
.step-number { width: 27px; height: 27px; border-radius: 8px; }
.panel-kicker { font-size: 7px; }
.panel-heading h2 { font-size: 14px; }
.drop-zone { min-height: 128px; flex: 1; }
.privacy-note { font-size: 9px; }

.preview-top { flex: none; margin-bottom: 8px; }
.preview-top .panel-heading .step-number { display: none; }
.preview-top .panel-kicker { display: none; }
.preview-top .panel-heading h2 { font-size: 13px; }
.view-switch { padding: 2px; border-radius: 10px; }
.view-switch button { min-height: 30px; padding-inline: 9px; font-size: 9px; }
.processing-line { min-height: 27px; flex: none; }
.comparison { min-height: 0; flex: 1; }
.image-side { display: flex; min-height: 0; flex-direction: column; }
.image-frame { min-height: 0; max-height: none; flex: 1; aspect-ratio: auto; }
.image-side figcaption { flex: none; padding-top: 7px; }
.delivery-readout { flex: none; grid-template-columns: minmax(110px, 0.8fr) minmax(0, 2fr); gap: 11px; margin-top: 10px; padding-top: 10px; }
.readout-stats { gap: 6px; }
.readout-stats > div { gap: 4px; }
.readout-stats strong { font-size: 11px; }
.readout-exact { font-size: 8px; }
.palette-row { flex: none; margin-top: 8px; padding-top: 8px; }
.swatch { width: 15px; height: 15px; border-radius: 4px; }
.preview-actions { flex: none; margin-top: 9px; }
.preview-actions .download-button { min-height: 43px; }
.preview-actions .clear-button { width: 43px; min-width: 43px; }

.preview-empty {
  display: grid;
  min-height: 0;
  flex: 1;
  align-content: center;
  justify-items: center;
  gap: 11px;
  padding: 18px;
  border: 1px dashed rgba(213, 255, 98, 0.22);
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 40%, rgba(213, 255, 98, 0.075), transparent 66%);
  text-align: center;
}

.empty-icon { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(213, 255, 98, 0.2); border-radius: 17px; color: var(--acid); background: rgba(213, 255, 98, 0.055); }
.empty-icon svg { width: 34px; height: 34px; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.preview-empty strong { font-size: clamp(16px, 2vw, 22px); font-weight: 550; letter-spacing: -0.035em; }
.preview-empty > span:not(.empty-icon) { max-width: 270px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.empty-open-button { display: inline-flex; min-height: 42px; align-items: center; gap: 18px; margin-top: 5px; padding: 0 14px; border: 0; border-radius: 11px; color: #172012; background: var(--acid); cursor: pointer; font-size: 11px; font-weight: 650; }
.empty-open-button span { font-size: 16px; }

.controls-panel > .panel-heading { position: sticky; z-index: 2; top: -15px; margin: -1px -1px 6px; padding: 1px 1px 10px; background: var(--ink-soft); }
.control-block { padding: 9px 0; }
.control-block select { min-height: 38px; margin-top: 6px; font-size: 10px; }
.control-block > label, .range-heading label { font-size: 10px; }
.range-heading output { font-size: 9px; }
.control-block input[type="range"] { height: 22px; margin-top: 5px; }
.field-note, .range-ends, .export-note { display: none; }
.custom-budget-control:not([hidden]) .field-note { display: block; }
.jpeg-matte-control:not([hidden]) .field-note { display: block; }
.control-pair { gap: 8px; }
.control-pair .control-block { padding-top: 9px; }
.advanced-controls { margin-top: 7px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-controls summary { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 10px; color: #e5ece3; cursor: pointer; font-size: 10px; font-weight: 600; list-style: none; }
.advanced-controls summary::-webkit-details-marker { display: none; }
.advanced-controls summary::after { content: "+"; color: var(--acid); font: 17px var(--sans); }
.advanced-controls[open] summary::after { content: "−"; }
.advanced-count { margin-left: auto; color: var(--faint); font: 8px var(--mono); font-weight: 400; }
.advanced-controls[open] .control-block { padding-block: 10px; }
.advanced-controls[open] .field-note { display: block; }
.action-row { margin-top: 11px; }
.download-button { min-height: 44px; font-size: 11px; }
.clear-button { width: 44px; min-width: 44px; }
.mobile-actionbar, .app-navigation { display: none; }

@media (max-width: 1050px) {
  .app-shell {
    grid-template-rows: 52px minmax(0, 1fr) auto auto;
    gap: 8px;
    padding-right: 12px;
    padding-left: 12px;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }

  .topbar { min-height: 0; }
  .local-badge { display: inline-flex; min-height: 30px; gap: 6px; padding: 0 8px; font-size: 7px; letter-spacing: 0.04em; }
  .local-dot { width: 6px; height: 6px; }
  .open-image-button { width: 42px; min-height: 38px; padding: 0; }
  .open-image-button span { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; }
  .source-panel { display: none; }
  .preview-panel, .controls-panel { grid-column: 1; grid-row: 1; padding: 13px; border-radius: 16px; }
  .controls-panel { display: none; }
  .workspace[data-screen="tune"] .preview-panel { display: none; }
  .workspace[data-screen="tune"] .controls-panel { display: block; }
  .workspace[data-screen="tune"] .controls-panel { overflow-y: auto; }
  .mobile-actionbar { display: flex; min-height: 48px; align-items: stretch; gap: 8px; }
  .mobile-download, .mobile-share, .mobile-cancel { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; cursor: pointer; font-size: 12px; font-weight: 650; }
  .mobile-download { border: 0; color: #172012; background: var(--acid); }
  .mobile-download:disabled { color: #909b8b; background: #303a31; cursor: not-allowed; }
  .mobile-share { border: 1px solid var(--line-strong); color: var(--paper); background: var(--panel-raised); }
  .mobile-share:disabled { color: var(--faint); cursor: not-allowed; }
  .mobile-cancel { border: 1px solid var(--line-strong); color: var(--paper); background: var(--panel-raised); }
  .mobile-processing-status { min-width: 0; flex: 1; align-self: center; overflow: hidden; color: var(--muted); font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-share svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-download-icon { font-size: 19px; line-height: 1; }
  .mobile-clear { display: grid; width: 48px; flex: none; place-items: center; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; }
  .mobile-clear:disabled { opacity: 0.38; cursor: not-allowed; }
  .mobile-clear svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
  .app-navigation { display: grid; min-height: 54px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px; border: 1px solid var(--line); border-radius: 15px; background: rgba(23, 30, 25, 0.96); }
  .app-navigation button { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 550; }
  .app-navigation button[aria-pressed="true"] { color: var(--acid); background: rgba(213, 255, 98, 0.08); }
  .app-navigation svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
  .preview-top { margin-bottom: 7px; }
  .preview-top .panel-heading h2 { font-size: 12px; }
  .view-switch button { min-height: 33px; }
  .comparison { grid-template-columns: minmax(0, 1fr); }
  .image-frame { min-height: 0; }
  .comparison[data-view="compare"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison[data-view="compare"] .image-frame { min-height: 180px; }
  .delivery-readout { grid-template-columns: minmax(90px, 0.7fr) minmax(0, 2fr); }
  .readout-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .readout-stats > div > span { font-size: 7px; }
  .readout-stats strong { font-size: 9px; }
  .palette-row { gap: 7px; }
  .swatches { flex-wrap: nowrap; overflow: hidden; }
  .swatch { width: 13px; height: 13px; }
  .preview-actions { display: none; }
  .empty-icon { width: 50px; height: 50px; }
  .preview-empty { gap: 9px; }
  .controls-panel > .panel-heading { top: -13px; }
}

@media (max-width: 520px) {
  .control-pair { grid-template-columns: minmax(0, 1fr); }
  .app-shell { grid-template-rows: 48px minmax(0, 1fr) 46px 56px; gap: 7px; padding-right: 9px; padding-left: 9px; }
  .topbar { min-height: 0; }
  .wordmark { gap: 8px; font-size: 10px; }
  .mark { width: 21px; height: 21px; }
  .workspace { min-height: 0; }
  .preview-panel, .controls-panel { padding: 10px; }
  .preview-top { align-items: center; flex-direction: row; gap: 6px; }
  .view-switch { width: auto; flex: none; }
  .view-switch button { min-height: 32px; padding-inline: 8px; font-size: 8px; }
  .processing-line { min-height: 23px; font-size: 8px; }
  .processing-line > span:last-child { font-size: 7px; }
  .image-frame { border-radius: 12px; }
  .image-side figcaption { font-size: 7px; }
  .delivery-readout { grid-template-columns: 1fr; gap: 7px; margin-top: 7px; padding-top: 7px; }
  .delivery-lead { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 4px; }
  .readout-label, .palette-label { display: none; }
  .readout-stats > div > span { font-size: 10px; }
  .delivery-lead strong { font-size: 12px; }
  .readout-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .readout-stats > div { gap: 3px; }
  .readout-stats strong { font-size: 12px; }
  .readout-exact { font-size: 10px; }
  .palette-row { margin-top: 6px; padding-top: 6px; }
  .palette-label, .palette-count { font-size: 9px; }
  .mobile-actionbar { min-height: 46px; }
  .mobile-download, .mobile-share, .mobile-cancel, .mobile-clear { border-radius: 11px; }
  .processing-line[data-state="busy"] > span:last-child { display: none; }
  .processing-action { display: none; }
  .app-navigation { min-height: 56px; }
  .workspace[data-screen="tune"] .controls-panel { padding: 9px 12px; }
  .controls-panel > .panel-heading { top: -9px; margin-bottom: 2px; padding-bottom: 7px; }
  .controls-panel > .panel-heading .step-number { width: 25px; height: 25px; }
  .control-block { padding: 7px 0; }
  .control-block select { min-height: 38px; }
  .control-block input[type="range"] { height: 22px; }
  .advanced-controls summary { min-height: 39px; }
  .comparison[data-view="compare"] { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .comparison[data-view="compare"] .image-frame { min-height: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keep common mobile controls easy to reach without enlarging desktop chrome. */
@media (max-width: 1050px) {
  .open-image-button {
    width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .text-button,
  .view-switch button,
  .inspect-trigger,
  .inspect-scale button,
  .empty-open-button,
  .control-block select,
  .custom-budget-entry input,
  .advanced-controls summary,
  .download-button,
  .clear-button,
  .app-navigation button {
    min-height: 44px;
  }

  .view-switch button {
    min-width: 44px;
  }

  .control-block input[type="range"] {
    height: 44px;
  }

  .clear-button,
  .preview-actions .clear-button {
    width: 44px;
    min-width: 44px;
  }
}
