:root {
  --ink: #18212c;
  --muted: #687383;
  --soft: #f5f7fb;
  --line: #dfe5ec;
  --card: #ffffff;
  --coral: #ef6b4d;
  --coral-dark: #d9573a;
  --coral-wash: #fff0eb;
  --mint: #dff2eb;
  --shadow: 0 18px 45px rgba(31, 47, 65, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 85% 0%, rgba(239, 107, 77, 0.1), transparent 28rem),
    var(--soft);
  color: var(--ink);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid rgba(239, 107, 77, 0.35);
  outline-offset: 3px;
}

.site-header, main, .site-footer { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 15px; letter-spacing: -0.02em; text-decoration: none; }
.brand strong { font-weight: 750; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--coral); box-shadow: 0 5px 13px rgba(239,107,77,.22); }
.brand-mark svg { width: 24px; fill: none; stroke: #fffaf7; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.brand-mark svg path:nth-child(2) { fill: #fffaf7; stroke: none; }
.brand-mark svg circle { fill: #fffaf7; stroke: none; }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; color: #61706f; font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #47a786; box-shadow: 0 0 0 4px rgba(71,167,134,.13); }

.hero { padding: 70px 0 42px; text-align: center; }
.eyebrow, .section-kicker { color: var(--coral-dark); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { margin: 13px 0 16px; font-size: clamp(42px, 7vw, 76px); line-height: .98; letter-spacing: -.065em; font-weight: 760; }
.hero h1 em { color: var(--coral); font-style: normal; }
.hero-copy { max-width: 470px; margin: 0 auto; color: var(--muted); font-size: 17px; line-height: 1.55; }

.workspace { max-width: 900px; margin: 0 auto; }
.upload-card {
  position: relative;
  min-height: 280px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 32px;
  border: 1.5px dashed #cfd8e2;
  border-radius: 22px;
  background: rgba(255,255,255,.62);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.upload-card:hover, .upload-card.is-dragging { border-color: var(--coral); background: #fff9f6; }
.upload-card.is-dragging { transform: scale(1.008); }
.upload-icon { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 19px; background: var(--coral-wash); color: var(--coral); }
.upload-icon svg { width: 31px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.upload-title { margin-top: 20px; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.upload-subtitle { margin-top: 7px; color: var(--muted); font-size: 14px; }
.upload-link { color: var(--coral-dark); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.upload-meta { margin-top: 24px; color: #9aa5b1; font-size: 11px; letter-spacing: .04em; }
.notice { min-height: 0; color: #a64d34; font-size: 13px; line-height: 1.45; }
.notice:not(:empty) { margin: 12px 4px -1px; padding: 11px 13px; border-radius: 10px; background: #fff1ec; }

.converter-panel, .results-panel { margin-top: 18px; padding: clamp(20px, 4vw, 32px); border: 1px solid rgba(220, 227, 235, .9); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 6px 0 0; font-size: 23px; letter-spacing: -.045em; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--coral-dark); }

.file-list { display: grid; gap: 8px; margin: 24px 0 28px; max-height: 234px; overflow-y: auto; }
.file-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto auto; gap: 11px; align-items: center; padding: 10px 12px; border: 1px solid #e9edf2; border-radius: 12px; background: #fbfcfd; }
.file-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; background: #edf1f5; }
.file-name { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.file-details { margin-top: 3px; color: var(--muted); font-size: 11px; }
.file-status { color: var(--muted); font-size: 11px; white-space: nowrap; }
.remove-file { width: 25px; height: 25px; padding: 0; border: 0; border-radius: 7px; color: #8b96a1; background: transparent; font-size: 18px; line-height: 1; }
.remove-file:hover { color: var(--coral-dark); background: var(--coral-wash); }

.settings-grid { display: grid; grid-template-columns: minmax(170px, .75fr) minmax(260px, 1.25fr); gap: 18px; }
.field { display: block; }
.field-label { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field-label output { color: var(--ink); }
.select-wrap { position: relative; display: block; }
.select-wrap::after { position: absolute; top: 50%; right: 14px; color: var(--muted); content: "⌄"; pointer-events: none; transform: translateY(-56%); }
select, #max-width { width: 100%; height: 43px; padding: 0 38px 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
input[type="range"] { width: 100%; accent-color: var(--coral); }
.range-hint { display: flex; justify-content: space-between; margin-top: 4px; color: #a5adb7; font-size: 10px; }

.resize-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 27px; padding-top: 21px; border-top: 1px solid #edf0f3; }
.switch-label { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; }
.switch { position: relative; display: block; width: 36px; height: 21px; border-radius: 30px; background: #d8dfe6; transition: .18s; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; content: ""; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: .18s; }
.switch-label input:checked + .switch { background: var(--coral); }
.switch-label input:checked + .switch::after { transform: translateX(15px); }
.switch-label strong, .switch-label small { display: block; }
.switch-label strong { font-size: 13px; }
.switch-label small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.resize-input { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.resize-input input { width: 104px; padding: 0 10px; }
.resize-input.is-disabled { opacity: .45; }

.jpeg-note { margin-top: 19px; padding: 11px 12px; border-radius: 10px; color: #876e5f; background: #fff7ed; font-size: 12px; line-height: 1.5; }
.jpeg-note > span { margin-right: 5px; color: var(--coral); }
.inline-control { display: inline-flex; align-items: center; gap: 5px; color: var(--coral-dark); font-weight: 700; }
.inline-control input { width: 20px; height: 20px; padding: 0; border: 0; background: transparent; vertical-align: -5px; }

.action-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 28px; }
.ready-count { margin-right: auto; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 16px; border-radius: 10px; font-size: 13px; font-weight: 750; transition: .18s; }
.primary-button { border: 1px solid var(--coral); color: #fff; background: var(--coral); box-shadow: 0 7px 16px rgba(239,107,77,.18); }
.primary-button:hover:not(:disabled) { border-color: var(--coral-dark); background: var(--coral-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; box-shadow: none; }
.button-icon { display: inline-block; margin-right: 6px; font-size: 16px; transform: rotate(-45deg); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.secondary-button:hover:not(:disabled) { border-color: #b7c1cd; background: #fafbfd; }

.results-panel { border-color: #d8e9e2; }
.results-heading { align-items: center; }
.results-list { display: grid; gap: 10px; margin-top: 22px; }
.result-row { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto auto; align-items: center; gap: 13px; padding: 10px; border: 1px solid #e9edf0; border-radius: 12px; }
.result-preview { width: 62px; height: 54px; object-fit: cover; border-radius: 8px; background-color: #f0f2f5; background-image: linear-gradient(45deg,#e7ebef 25%,transparent 25%),linear-gradient(-45deg,#e7ebef 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e7ebef 75%),linear-gradient(-45deg,transparent 75%,#e7ebef 75%); background-position: 0 0,0 6px,6px -6px,-6px 0; background-size: 12px 12px; }
.result-name { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.result-size { margin-top: 5px; color: var(--muted); font-size: 11px; }
.result-delta { color: #399073; font-size: 12px; font-weight: 750; white-space: nowrap; }
.result-delta.is-larger { color: #b16c4f; }
.download-button { min-height: 34px; padding: 0 11px; border: 1px solid #d4e6df; border-radius: 8px; color: #377f69; background: #f4fbf8; font-size: 12px; font-weight: 750; }
.download-button:hover { background: var(--mint); }

.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; max-width: 900px; margin: 100px auto 80px; }
.trust-grid article { padding: 22px 4px 0; border-top: 1px solid #dce3ea; }
.trust-number { color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.trust-grid h3 { margin: 13px 0 8px; font-size: 15px; letter-spacing: -.02em; }
.trust-grid p { max-width: 245px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.site-footer { display: flex; justify-content: space-between; padding: 22px 0 34px; border-top: 1px solid #dfe5ea; color: #89949f; font-size: 11px; }

.is-hidden { display: none !important; }
.is-busy .upload-card { pointer-events: none; opacity: .66; }
.status-processing { color: var(--coral-dark); }
.status-done { color: #399073; }
.status-error { color: #a64d34; }

@media (max-width: 680px) {
  .site-header, main, .site-footer { width: min(100% - 28px, 560px); }
  .site-header { padding: 18px 0; }
  .privacy-pill { font-size: 0; }
  .privacy-pill .status-dot { margin-right: 2px; }
  .hero { padding: 52px 0 30px; }
  .hero h1 { font-size: clamp(40px, 13vw, 58px); }
  .hero-copy { font-size: 15px; }
  .upload-card { min-height: 245px; }
  .settings-grid { grid-template-columns: 1fr; gap: 22px; }
  .resize-row { align-items: flex-start; flex-direction: column; }
  .resize-input { width: 100%; }
  .resize-input input { flex: 1; }
  .action-row { align-items: stretch; flex-wrap: wrap; }
  .ready-count { width: 100%; margin: 0 0 1px; }
  .primary-button, .secondary-button { flex: 1; }
  .results-heading { align-items: flex-start; flex-direction: column; }
  .results-heading .secondary-button { width: 100%; flex: initial; }
  .result-row { grid-template-columns: 52px minmax(0,1fr); }
  .result-preview { width: 52px; height: 48px; }
  .result-delta, .result-row .download-button { grid-column: 2; }
  .result-delta { margin-top: -8px; }
  .result-row .download-button { margin-top: -2px; }
  .trust-grid { grid-template-columns: 1fr; gap: 18px; margin: 64px auto 50px; }
  .trust-grid article { padding-top: 17px; }
  .trust-grid p { max-width: none; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}