@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --paper: #f1efe9;
  --ink: #202321;
  --muted: #777973;
  --line: #d7d4ca;
  --acid: #c5e86c;
  --acid-dark: #789b22;
  --white: #faf9f5;
  --error: #a74735;
  --mono: 'DM Mono', monospace;
  --sans: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(1220px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0 25px;
  display: flex;
  flex-direction: column;
}

.site-header { border-bottom: 1px solid var(--line); padding-bottom: 30px; }
.eyebrow, .control-kicker, .panel-label, .range-labels, .site-footer, .stats span, .file-name, .privacy-note {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}

.eyebrow, .control-kicker { color: var(--acid-dark); margin: 0 0 15px; }
h1 { font-size: clamp(54px, 9vw, 122px); line-height: .82; letter-spacing: -.08em; margin: 0; font-weight: 600; }
h1 em { color: var(--acid-dark); font-style: normal; }
.intro { margin: 27px 0 0; color: var(--muted); font-size: 17px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .85fr); gap: 34px; padding: 34px 0 46px; flex: 1; }
.preview-panel, .controls-panel { min-width: 0; }
.panel-label, .preview-footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); }
.panel-label { margin-bottom: 10px; }
.preview-frame { position: relative; aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; background-color: #dddacf; background-image: linear-gradient(45deg, #d4d1c7 25%, transparent 25%), linear-gradient(-45deg, #d4d1c7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d4d1c7 75%), linear-gradient(-45deg, transparent 75%, #d4d1c7 75%); background-size: 28px 28px; background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}
.preview-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.empty-state { text-align: center; color: var(--muted); }
.empty-mark { display: block; margin-bottom: 12px; color: var(--acid-dark); font-size: 40px; font-weight: 300; line-height: 1; }
.empty-state p { margin: 0 0 7px; font-size: 15px; color: var(--ink); }
.empty-state small { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.preview-footer { padding-top: 11px; font-size: 10px; }
#status { text-align: right; }

.controls-panel { border-left: 1px solid var(--line); padding-left: 34px; display: flex; flex-direction: column; }
.control-group { padding: 2px 0 28px; border-bottom: 1px solid var(--line); }
.passes-group { padding-top: 27px; }
.control-kicker { margin-bottom: 9px; }
h2 { font-size: 21px; line-height: 1; letter-spacing: -.04em; margin: 0; font-weight: 600; }
.upload-button { margin-top: 22px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; border: 1px solid var(--ink); background: var(--acid); cursor: pointer; font-weight: 600; transition: background .15s, transform .15s; }
.upload-button:hover { background: #d1f282; transform: translate(-2px, -2px); }
.upload-button:focus-within { outline: 3px solid var(--acid-dark); outline-offset: 3px; }
.button-arrow { font-size: 21px; line-height: .7; }
#image-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-name { overflow: hidden; margin: 12px 0 0; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.compress-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 18px; padding: 13px 16px; border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; font-weight: 600; transition: background .15s, color .15s, transform .15s; }
.compress-button:not(:disabled):hover { background: var(--ink); color: var(--white); transform: translate(-2px, -2px); }
.compress-button:focus-visible { outline: 3px solid var(--acid-dark); outline-offset: 3px; }
.compress-button:disabled { cursor: not-allowed; opacity: .35; }
.control-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.number-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; }
.number-wrap input { width: 70px; padding: 4px 5px; border: 0; border-bottom: 2px solid var(--ink); background: transparent; color: var(--ink); font-family: var(--sans); font-size: 27px; font-weight: 600; text-align: right; outline: none; }
.number-wrap input:focus { border-color: var(--acid-dark); }
input[type='range'] { width: 100%; height: 5px; margin: 30px 0 8px; accent-color: var(--acid-dark); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.range-labels span:last-child { color: var(--acid-dark); }
.hint { margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 26px 0; gap: 9px; }
.stat { min-width: 0; }
.stats span { display: block; color: var(--muted); font-size: 9px; margin-bottom: 7px; }
.stats strong { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.save-button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); cursor: pointer; font-weight: 600; transition: background .15s, color .15s, transform .15s; }
.save-button:not(:disabled):hover { background: var(--acid); color: var(--ink); transform: translate(-2px, -2px); }
.save-button:focus-visible, .upload-button:focus-visible { outline: 3px solid var(--acid-dark); outline-offset: 3px; }
.save-button:disabled { cursor: not-allowed; opacity: .35; }
.privacy-note { margin: 13px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.site-footer { display: flex; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }

.is-error { color: var(--error) !important; }
@media (max-width: 760px) {
  .page-shell { width: min(100% - 30px, 560px); padding-top: 29px; }
  .workspace { grid-template-columns: 1fr; gap: 36px; padding-top: 25px; }
  .controls-panel { border-left: 0; border-top: 1px solid var(--line); padding: 30px 0 0; }
  .preview-frame { aspect-ratio: 1 / 1; }
  .site-footer { margin-top: auto; }
}
@media (max-width: 420px) {
  h1 { font-size: 60px; }
  .intro { font-size: 15px; }
  .preview-footer { display: block; line-height: 1.8; }
  #status { text-align: left; }
}
