:root {
  --bg: #f3efe6;
  --paper: #fffdf8;
  --ink: #1c1915;
  --muted: #5e584f;
  --line: #d8d0c3;
  --line-strong: #c3baab;
  --accent: #0f5c4c;
  --accent-hover: #0b4a3d;
  --accent-soft: #e4f0ec;
  --danger: #8b2e1f;
  --danger-soft: #f8ece9;
  --warn: #7a5410;
  --warn-soft: #f6eedd;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.05), 0 12px 28px rgba(28, 25, 21, 0.06);
  --radius: 20px;
  --sans: "Söhne", "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

html { color-scheme: light; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

.wrap { width: min(760px, calc(100% - 32px)); margin: 0 auto; }
.site-header, .site-footer { width: min(960px, calc(100% - 32px)); margin: 0 auto; }

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 8px;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.wordmark:hover { color: var(--ink); }
.header-note {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

main { flex: 1; padding: 12px 0 64px; }

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 28px 0 10px;
}
.lede { font-size: 1.05rem; color: var(--muted); margin: 0 0 28px; max-width: 40rem; }

.tool-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.drop-panel { padding: 12px 12px 0; }
.drop-panel.has-files { padding-bottom: 0; }

.dropzone {
  display: block;
  margin: 0;
  padding: 40px 24px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  user-select: none;
}
.drop-panel.has-files .dropzone {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.drop-panel.has-files .dropzone h2 { font-size: 0.95rem; margin: 0; }
.drop-panel.has-files .drop-lead,
.drop-panel.has-files .drop-icon { display: none; }
.dropzone:hover, .dropzone.is-dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.dropzone:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  color: var(--accent);
}
.dropzone h2 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 650; }
.drop-lead { margin: 0; color: var(--muted); font-size: 0.95rem; }

.drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 12px 0 8px;
}
.drop-panel.has-files .drop-actions { display: none; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: 8px 20px 14px;
}
.field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.92rem; }
.field label { white-space: nowrap; }
.field select, .field input[type="range"] { accent-color: var(--accent); }
.field select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
}
.quality-value { min-width: 2.2em; color: var(--ink); font-variant-numeric: tabular-nums; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.btn {
  font: inherit;
  font-weight: 650;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--bg); }
.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-soft:hover { background: #d5e8e2; }
.icon-btn {
  font: inherit;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

.results { padding: 0 12px 12px; display: grid; gap: 10px; }
.file-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background-color: #efeae0;
  background-image:
    linear-gradient(45deg, #e0d9cc 25%, transparent 25%),
    linear-gradient(-45deg, #e0d9cc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0d9cc 75%),
    linear-gradient(-45deg, transparent 75%, #e0d9cc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.thumb img, .thumb-ph {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
}
.thumb-ph { display: grid; place-items: center; color: var(--muted); font-size: 11px; background: #ece7dc; border-radius: 8px; }
.file-meta { min-width: 0; }
.file-meta strong { display: block; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span, .file-meta small { color: var(--muted); font-size: 0.82rem; }
.file-actions { display: flex; align-items: center; gap: 4px; }
.status-ok { color: var(--accent); }
.status-warn { color: var(--warn); }
.status-err { color: var(--danger); }
.size-up { color: var(--muted); }

.steps, .explain, .faq { margin-top: 42px; }
.steps h2, .explain h2, .faq h2, .more h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
.steps ol { margin: 0; padding: 0 0 0 1.15rem; color: var(--ink); }
.steps li { margin: 0 0 8px; }
.explain p, .faq p { color: var(--ink); margin: 0 0 12px; }
.faq details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

.more { margin-top: 36px; }
.more ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; }

.site-footer {
  padding: 24px 0 32px;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
  margin-top: auto;
}
.site-footer p { margin: 0 0 8px; }

@media (max-width: 600px) {
  .site-header { flex-direction: column; gap: 4px; }
  .file-row { grid-template-columns: 52px 1fr; }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .toolbar-actions { margin-left: 0; width: 100%; }
  .toolbar-actions .btn, .toolbar-actions .btn-ghost { flex: 1; }
  .dropzone { padding: 28px 16px 16px; }
  .thumb, .thumb img, .thumb-ph { width: 52px; height: 52px; }
}
