:root {
  --bg: #f4f0e7;
  --surface: #ebe4d4;
  --surface-dark: #ebe4d4;
  --selected: #4a4032;
  --ink: #2c2418;
  --primary: #2c2418;
  --accent: #c9622d;
  --muted: #7a6f5c;
  --line: rgba(44, 36, 24, .14);
  --mono: "DM Mono", monospace;
  --sans: "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: var(--sans); min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .03; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

main { width: min(1440px, calc(100% - 48px)); margin: auto; }

/* ===== Hero ===== */
.hero { display: grid; grid-template-columns: 1fr 1fr; align-items: end; padding: clamp(28px, 4vw, 48px) 0 32px; }
.hero h1 { margin: 0; font-size: clamp(42px, 6vw, 88px); line-height: .98; letter-spacing: -.065em; font-weight: 900; }
.hero h1 em { color: var(--primary); font-style: normal; position: relative; }
.hero h1 em:after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; background: var(--accent); transform: rotate(-1deg); }
.hero p { margin: 0 0 10px auto; max-width: 430px; font-size: clamp(15px, 1.6vw, 20px); line-height: 1.8; color: var(--muted); }

/* ===== Workbench ===== */
.workbench { display: grid; grid-template-columns: minmax(360px, .85fr) minmax(540px, 1.15fr); border: 1px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); margin-bottom: 100px; }
.control-panel { padding: 40px; background: var(--surface); border-right: 1px solid var(--ink); display: flex; flex-direction: column; }
.drop-panel { padding: 40px; background: var(--surface-dark); color: var(--ink); min-height: 600px; display: flex; flex-direction: column; }

/* ===== Step heading ===== */
.step-heading { display: flex; gap: 13px; align-items: center; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.step-heading > span { display: grid; place-items: center; width: 34px; height: 34px; background: var(--ink); color: var(--bg); font: 12px var(--mono); }
.step-heading div { display: flex; flex-direction: column; gap: 2px; }
.step-heading b { font-size: 15px; }
.step-heading small { font: 9px var(--mono); letter-spacing: .12em; opacity: .5; }
.step-heading.dark { border-color: var(--line); }
.step-heading.dark > span { background: var(--accent); color: #fff; }

/* ===== Format picker ===== */
fieldset { margin: 26px 0 0; padding: 0; border: 0; }
legend { font-weight: 700; font-size: 13px; margin-bottom: 14px; }
.format-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.format-grid label:first-child { grid-column: 1 / -1; }
.format-grid input { position: absolute; opacity: 0; }
.format-grid span { display: block; padding: 12px 14px; border: 1px solid var(--line); background: var(--bg); font: 12px var(--mono); cursor: pointer; transition: .2s; }
.format-grid span:hover { border-color: var(--ink); transform: translateY(-1px); }
.format-grid input:checked + span { background: var(--selected); color: var(--bg); border-color: var(--selected); box-shadow: inset 4px 0 #d77a4c; }

/* ===== Compression buttons ===== */
.compression-field { border-top: 1px solid var(--line); padding-top: 24px; }
.compression-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.compression-grid input { position: absolute; opacity: 0; }
.compression-grid span { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; transition: .2s; }
.compression-grid span:hover { border-color: var(--ink); transform: translateY(-1px); }
.compression-grid input:checked + span { background: var(--selected); color: var(--bg); border-color: var(--selected); box-shadow: inset 4px 0 #d77a4c; }
.compression-grid b { font-size: 13px; }
.compression-grid small { font: 10px var(--mono); opacity: .7; }

/* ===== Process button ===== */
.process-btn { margin-top: 32px; border: 0; background: var(--ink); color: var(--bg); min-height: 60px; padding: 0 16px 0 22px; display: flex; align-items: center; gap: 10px; font-weight: 900; cursor: pointer; box-shadow: 5px 5px 0 var(--accent); transition: .2s; }
.process-btn b { font: 10px var(--mono); opacity: .55; }
.process-btn i { font-style: normal; font-size: 25px; margin-left: auto; }
.process-btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--accent); }
.process-btn:disabled { filter: grayscale(1); opacity: .38; cursor: not-allowed; }

/* ===== Dropzone ===== */
.dropzone { flex: 1; min-height: 420px; border: 1px dashed var(--line); margin-top: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: .25s; position: relative; overflow: hidden; }
.dropzone:before { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; background: var(--accent); filter: blur(90px); opacity: .12; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(201, 98, 45, .04); }
.drop-visual { position: relative; margin-bottom: 14px; }
.image-glyph { font-size: 52px; color: var(--accent); line-height: 1; }
.plus { position: absolute; right: -18px; top: -10px; background: var(--accent); color: #fff; width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; font: 18px var(--mono); }
.dropzone h2 { font-size: 24px; margin: 8px 0; }
.dropzone p { font-size: 13px; color: var(--muted); margin: 0 0 22px; }
.dropzone strong { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.dropzone small { font: 9px var(--mono); opacity: .42; letter-spacing: .05em; }

/* ===== Queue ===== */
.queue-wrap { margin-top: 20px; }
.queue-head { display: flex; justify-content: space-between; font: 11px var(--mono); padding-bottom: 10px; }
.queue-head button { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 11px; }
.file-list { list-style: none; padding: 0; margin: 0; max-height: 240px; overflow: auto; }
.file-item { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.file-thumb { width: 44px; height: 38px; object-fit: cover; background: var(--surface); }
.file-meta { min-width: 0; }
.file-meta b { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta small { font: 9px var(--mono); opacity: .46; }
.remove-btn { border: 1px solid var(--line); background: none; color: var(--ink); width: 28px; height: 28px; cursor: pointer; }
.remove-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Results ===== */
.results { margin: -40px 0 100px; }
.results-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.results-title > div { display: flex; align-items: center; gap: 14px; }
.results-title span { font: 11px var(--mono); background: var(--accent); color: #fff; padding: 9px; }
.results-title h2 { margin: 0; font-size: 28px; }
.results-title button { border: 1px solid var(--ink); background: var(--ink); color: var(--bg); padding: 12px 16px; cursor: pointer; }
.result-list { display: grid; gap: 8px; }
.result-item { display: grid; grid-template-columns: 50px 1fr auto auto; gap: 15px; align-items: center; border: 1px solid var(--line); padding: 10px; background: var(--surface); }
.result-item img { width: 50px; height: 45px; object-fit: cover; }
.result-name b { font-size: 12px; display: block; }
.result-name small, .saving { font: 10px var(--mono); opacity: .55; }
.saving.good { color: var(--accent); opacity: 1; }
.download-btn { background: var(--ink); border: 1px solid var(--ink); padding: 9px 13px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--bg); }

/* ===== Toast ===== */
.toast { position: fixed; bottom: 25px; left: 50%; transform: translate(-50%, 30px); background: var(--ink); color: var(--bg); padding: 12px 18px; font-size: 12px; opacity: 0; pointer-events: none; transition: .3s; z-index: 30; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Mobile ===== */
@media (max-width: 760px) {
  main { width: min(100% - 28px, 600px); }
  .hero { display: block; padding: 32px 0 24px; }
  .hero p { margin: 28px 0 0; }
  .workbench { grid-template-columns: 1fr; box-shadow: 6px 6px 0 var(--ink); margin-bottom: 70px; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--ink); padding: 28px; min-height: auto; }
  .drop-panel { padding: 28px; min-height: 460px; }
  .dropzone { min-height: 320px; }
  .compression-grid { grid-template-columns: 1fr; }
  .result-item { grid-template-columns: 44px 1fr auto; }
  .saving { display: none; }
  .results { margin: 0 0 70px; }
  .results-title h2 { font-size: 22px; }
  .hero h1 { font-size: clamp(40px, 14vw, 64px); }
}

@media (orientation: landscape) and (max-height: 650px) and (min-width: 761px) {
  .hero { padding: 24px 0 20px; }
  .hero h1 { font-size: 58px; }
  .workbench { margin-bottom: 60px; }
  .drop-panel { min-height: 470px; }
  .dropzone { min-height: 300px; }
  .control-panel, .drop-panel { padding: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
