:root {
  --bg: #efe6d6;
  --bg-2: #f7f1e6;
  --ink: #241c14;
  --soft: #5e5146;
  --line: #ddcfc0;
  --accent: #a33b24;
  --accent-ink: #fff8f2;
  --ok: #1d6b42;
  --ok-bg: #e6f3e6;
  --warn: #8a5a12;
  --warn-bg: #f8ecd2;
  --bad: #8d2430;
  --bad-bg: #f8e4e2;
  --card: #fffaf3;
  --shadow: 0 1px 0 rgba(36, 28, 20, .05), 0 18px 40px rgba(90, 55, 20, .07);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --bg-2: #1e1a16;
    --ink: #f6efe6;
    --soft: #c3b5a6;
    --line: #3c332b;
    --accent: #e07a5f;
    --accent-ink: #2a120c;
    --ok: #8fd0a8;
    --ok-bg: #173024;
    --warn: #e6c27a;
    --warn-bg: #2d2618;
    --bad: #f0a8a4;
    --bad-bg: #3a201f;
    --card: #241e19;
    --shadow: 0 18px 40px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 0% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
}
body.dragging { background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
img, video, svg { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: .95; margin: 0; font-weight: 460; }
h2 { font-size: 1.7rem; margin: 0; }
h3 { font-size: 1.2rem; margin: 0 0 .3rem; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: 12px; top: -40px; z-index: 5;
  background: var(--accent); color: var(--accent-ink); padding: .4rem .7rem; border-radius: 999px;
}
.skip:focus { top: 12px; }

.mast, .hero, .drop, .options, .results, .notes, .foot { width: min(1040px, calc(100% - 32px)); margin-left: auto; margin-right: auto; }
.mast { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 0 8px; }
.brand { color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.15rem; }
.pill { margin: 0; color: var(--soft); font-family: var(--mono); font-size: .75rem; letter-spacing: .02em; }
.hero { padding: 28px 0 8px; }
.lede { max-width: 42rem; margin-top: 14px; color: var(--soft); font-size: 1.12rem; }

.drop {
  position: relative;
  margin-top: 28px;
  min-height: 240px;
  padding: 36px 28px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center;
  box-shadow: var(--shadow);
}
.drop:hover, body.dragging .drop { border-style: solid; background: var(--card); }
.crop { position: absolute; inset: 10px; pointer-events: none; }
.crop span { position: absolute; width: 18px; height: 18px; border: 1.5px solid var(--accent); }
.crop span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.crop span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.crop span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.crop span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.drop-copy p { color: var(--soft); margin-top: 6px; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

button, .quiet-button {
  border: 0; border-radius: 999px; padding: .65rem 1.1rem;
  background: var(--accent); color: var(--accent-ink); font-weight: 550;
}
.quiet-button, button.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
button:disabled { opacity: .5; cursor: not-allowed; }

.options {
  margin-top: 18px; border: 0; padding: 0;
  display: grid; grid-template-columns: auto minmax(220px, 360px); gap: 8px 28px; align-items: center;
}
.options legend { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); padding: 0; margin-bottom: 4px; grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .85rem; color: var(--soft); }
select {
  width: 100%; max-width: 100%;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: .55rem .7rem;
}
.field, .options, .batch { min-width: 0; }
.batch { flex-wrap: wrap; }
.explain { grid-column: 1 / -1; color: var(--soft); max-width: 46rem; }

.results { margin-top: 34px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
#results-count { color: var(--soft); font-family: var(--mono); font-size: .8rem; }

.file {
  display: grid; grid-template-columns: 116px 1fr; gap: 16px;
  background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.preview {
  width: 116px; height: 116px; border-radius: 10px; overflow: hidden; background: var(--bg-2);
  display: grid; place-items: center; color: var(--soft); font-family: var(--mono); font-size: .72rem;
}
.preview img, .preview video { width: 100%; height: 100%; object-fit: cover; }
.filename { font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: 0; overflow-wrap: anywhere; }
.summary { margin-top: 2px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 8px; color: var(--soft); font-family: var(--mono); font-size: .8rem; }
.badge { border-radius: 999px; padding: .1rem .5rem; background: var(--bg); color: var(--ink); }
.status { margin-top: 8px; font-weight: 550; }
.status.ok { color: var(--ok); }
.status.working { color: var(--soft); font-weight: 450; }
.status.bad { color: var(--bad); }
.warnings { margin: 8px 0 0; padding: 0; list-style: none; }
.warnings li { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: .35rem .6rem; margin-top: 6px; font-size: .92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions button { padding: .45rem .85rem; }
.copy {
  background: transparent; color: var(--accent); padding: 0; border-radius: 0;
  text-align: left; font-weight: 500;
}
.details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.details dl, .tag-list { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: 4px 12px; margin: 0; }
.details dt { color: var(--soft); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.tag-list { margin-top: 8px; font-family: var(--mono); font-size: .78rem; }
details summary { cursor: pointer; color: var(--soft); }
.batch { display: flex; gap: 10px; justify-content: flex-end; }

.notes { margin-top: 20px; padding-bottom: 28px; }
.note-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
.note-grid article { background: color-mix(in srgb, var(--card) 75%, transparent); border-radius: 14px; padding: 14px 16px; }
.note-grid p { color: var(--soft); }
.privacy { margin-top: 16px; max-width: 46rem; }
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 18px 0 32px; color: var(--soft); border-top: 1px solid var(--line); }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--bg); padding: .5rem .9rem; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.manual { position: fixed; inset: 0; background: rgba(20, 14, 10, .45); display: grid; place-items: center; padding: 16px; }
.manual[hidden] { display: none; }
.manual-card { background: var(--card); color: var(--ink); border-radius: 16px; padding: 18px; width: min(420px, 100%); display: grid; gap: 10px; }
.manual-card input { width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg); }
.noscript { width: min(1040px, calc(100% - 32px)); margin: 12px auto; padding: 12px 14px; background: var(--warn-bg); color: var(--warn); border-radius: 12px; }

@media (max-width: 800px) {
  .note-grid { grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .mast { flex-direction: column; align-items: flex-start; }
  .file { grid-template-columns: 72px 1fr; gap: 10px; padding: 10px; }
  .preview { width: 72px; height: 72px; }
  .details dl, .tag-list { grid-template-columns: 1fr; }
  .drop { padding: 28px 16px; min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast { transition: none; }
}
