:root {
  --ink: #1b2733;
  --table: #e9eef1;
  --panel: #f6f8f9;
  --sheet: #ffffff;
  --accent: #3a4bdc;
  --muted: #566673;
  --line: #c5d0d8;
  --good: #17724a;
  --bad: #b3261e;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-text-size-adjust: 100%;
}
html:lang(zh-Hant) {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei",
    "Noto Sans CJK TC", sans-serif;
}
html:lang(ja) {
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI",
    "Yu Gothic", "Meiryo", "Noto Sans CJK JP", sans-serif;
}

body {
  margin: 0;
  background: var(--table);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.top, main, .foot {
  width: min(880px, 100% - 40px);
  margin-inline: auto;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px 0;
}
.brand {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.langs { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.langs a {
  color: var(--muted);
  text-decoration: none;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.langs a:hover { color: var(--ink); }
.langs a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.intro { padding: 28px 0 24px; }
h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 4.6vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 760;
  max-width: 20ch;
}
html:lang(zh-Hans) h1, html:lang(zh-Hant) h1, html:lang(ja) h1 { max-width: 22ch; letter-spacing: 0; }
.lead { margin: 0; color: var(--muted); font-size: 1.1rem; max-width: 60ch; }

.tool {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 24px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field .check-label { font-weight: 600; font-size: 0.95rem; }
.field output { font-weight: 400; color: var(--muted); margin-inline-start: 6px; }
.check-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--sheet);
  color: var(--ink);
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="range"]:disabled { opacity: 0.4; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.note { margin: 12px 0 0; font-size: 0.92rem; color: var(--muted); }

/* The drop area is framed by four crop marks, like a print proof. */
.drop {
  position: relative;
  margin: 20px 0 0;
  padding: 56px 24px;
  background: var(--panel);
  text-align: center;
}
.crop {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0 solid var(--ink);
  transition: inset 0.16s ease-out;
}
.crop.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.crop.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.crop.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.crop.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }
.drop.over { background: #eceefd; }
.drop.over .crop { border-color: var(--accent); }
.drop.over .tl { top: 22px; left: 22px; }
.drop.over .tr { top: 22px; right: 22px; }
.drop.over .bl { bottom: 22px; left: 22px; }
.drop.over .br { bottom: 22px; right: 22px; }

.drop-title { margin: 0 0 16px; font-size: 1.25rem; font-weight: 650; }
.drop-hint { margin: 16px auto 0; color: var(--muted); font-size: 0.92rem; max-width: 46ch; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--sheet);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.3;
}
.btn:hover { background: var(--table); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2f3ec0; }
.btn.ghost { border-color: var(--line); color: var(--muted); font-weight: 500; }
.btn.small { padding: 6px 12px; font-size: 0.92rem; }

.bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.bar[hidden], [hidden] { display: none !important; }

.results { list-style: none; margin: 16px 0 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  background: var(--table);
  border-radius: 3px;
}
.info { min-width: 0; display: flex; flex-direction: column; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 0.92rem; color: var(--muted); }
.meta .good { color: var(--good); font-weight: 600; }
.meta.err { color: var(--bad); }
.act { display: flex; align-items: center; gap: 8px; }
.x {
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.x:hover { background: var(--table); color: var(--ink); }

.content { padding: 24px 0 8px; }
.content section { padding-top: 40px; }
.content h2 { margin: 0 0 14px; font-size: 1.35rem; line-height: 1.3; }
.content h3 { margin: 22px 0 4px; font-size: 1.05rem; }
.content p { margin: 0 0 6px; max-width: 64ch; color: #33424e; }

.foot { padding: 48px 0 40px; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 560px) {
  .tool { padding: 14px; }
  .drop { padding: 44px 16px; }
  .row { grid-template-columns: 48px 1fr; }
  .thumb { width: 48px; height: 48px; }
  .act { grid-column: 1 / -1; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .crop { transition: none; }
}
