/* Comic Scan Cleaner. Same brutalist Cappuccino palette as captainepub.com and Comic EPUB Maker. */
:root {
  --cream: #f2f5df;
  --yellow: #f7d585;
  --orange: #db903b;
  --mauve: #88617f;
  --rust: #892f1d;
  --brown: #3c0909;

  --paper: var(--cream);
  --ink: var(--brown);
  --card: #fffdf4;
  --muted: var(--mauve);
  --accent: var(--rust);
  --accent-ink: var(--cream);
  --header: var(--yellow);
  --warn-bg: #fbe6c4;
  --error-bg: #f6d0c6;
  --ok-bg: #e3edc8;

  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --display: "Arial Black", "Archivo Black", "Lato", "Helvetica Neue", Arial, system-ui, sans-serif;
  --shadow: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1f0e0c;
    --ink: var(--cream);
    --card: #2c1613;
    --muted: #c9a9c0;
    --accent: var(--orange);
    --accent-ink: var(--brown);
    --header: #3c0909;
    --warn-bg: #4a3010;
    --error-bg: #5a1c12;
    --ok-bg: #2c3a14;
  }
}

* { box-sizing: border-box; }

/* Rules like label { display: block } would otherwise show elements the page hides. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); }

code { font-family: var(--mono); background: var(--card); border: 1px solid currentColor; padding: 0 4px; }

.top { background: var(--header); border-bottom: 3px solid var(--ink); padding: 24px 0; }
.top-inner { display: flex; gap: 24px; align-items: center; }
.logo svg { width: 110px; height: 110px; display: block; }
.kicker { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; font-weight: 700; }
h1 { font-family: var(--display); font-weight: 900; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; margin: 4px 0 8px; }
.lede { margin: 0; max-width: 60ch; }

.tabs { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 20px; }
.tabs button {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 10px 16px; border: 3px solid var(--ink); background: var(--card); color: var(--ink);
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

fieldset, .panel, .result {
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: var(--shadow) var(--shadow) 0 var(--ink);
  margin: 0 0 28px;
  padding: 18px 20px 20px;
}
legend { font-family: var(--display); font-weight: 900; font-size: 20px; padding: 0 8px; background: var(--card); }
.step {
  display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 6px;
  border: 3px solid var(--ink); border-radius: 50%; background: var(--orange); color: var(--brown); font-size: 15px;
}
.hint { color: var(--muted); margin: 0 0 12px; }
.req, .opt { font-weight: 400; font-size: 12px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.grid .wide { grid-column: 1 / -1; }
label { display: block; font-weight: 700; }
input[type="text"], input[type="number"], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  font: inherit; font-weight: 400; color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); border-radius: 0;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .drop:focus-within {
  outline: 3px solid var(--orange); outline-offset: 2px;
}

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 12px; border: 3px solid var(--ink); background: var(--paper); cursor: pointer; }
.choice input { margin-top: 5px; accent-color: var(--rust); }
.choice:has(input:checked) { background: var(--yellow); color: var(--brown); }

.drop {
  position: relative; display: grid; place-items: center; min-height: 120px; padding: 20px;
  border: 3px dashed var(--ink); background: var(--paper); text-align: center; cursor: pointer;
}
.drop.over { background: var(--yellow); color: var(--brown); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.summary { margin: 14px 0 0; }
.thumbs { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; max-height: 460px; overflow: auto; }
.thumbs li { border: 2px solid var(--ink); background: var(--paper); font-size: 11px; line-height: 1.3; }
.thumbs li.wide { grid-column: span 2; }
.thumbs img { display: block; width: 100%; height: 120px; object-fit: contain; background: #fff; border-bottom: 2px solid var(--ink); }
.thumbs .label { display: block; padding: 4px 5px 0; font-weight: 700; }
.thumbs .meta { display: block; padding: 0 5px 4px; color: var(--muted); overflow-wrap: anywhere; }
.thumbs li.flag { outline: 3px solid var(--orange); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 0 0 28px; }
button.primary {
  font: inherit; font-family: var(--display); font-size: 20px; font-weight: 900; cursor: pointer;
  padding: 12px 26px; border: 3px solid var(--ink); background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow) var(--shadow) 0 var(--ink);
}
button.primary:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--ink); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
progress { width: 220px; height: 18px; accent-color: var(--rust); }

.result h2 { font-family: var(--display); font-weight: 900; margin: 0 0 10px; font-size: 24px; }
.download {
  display: inline-block; margin: 6px 0 14px; padding: 12px 22px; font-weight: 700; text-decoration: none;
  border: 3px solid var(--ink); background: var(--yellow); color: var(--brown); box-shadow: 4px 4px 0 var(--ink);
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 14px; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.notes li { padding: 8px 12px; border: 2px solid var(--ink); }
.notes .error { background: var(--error-bg); }
.notes .warn { background: var(--warn-bg); }
.notes .info { background: var(--paper); }
.notes .ok { background: var(--ok-bg); }
p.error { color: var(--accent); font-weight: 700; margin: 8px 0 0; }

.foot { color: var(--muted); padding-bottom: 40px; }

@media (max-width: 560px) {
  .top-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .logo svg { width: 80px; height: 80px; }
  fieldset, .panel, .result { padding: 14px; box-shadow: 4px 4px 0 var(--ink); }
}

/* ---------- Scan Cleaner ---------- */

.sub { font-family: var(--display); font-weight: 900; font-size: 16px; margin: 18px 0 10px; }
.checks { display: grid; gap: 10px; margin: 0 0 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; accent-color: var(--rust); width: 18px; height: 18px; }
#strength-options { margin-top: 12px; }

.preview-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.preview-bar select { width: auto; min-width: 260px; margin: 0; }
button.secondary {
  font: inherit; font-weight: 700; cursor: pointer; padding: 9px 16px;
  border: 3px solid var(--ink); background: var(--yellow); color: var(--brown); box-shadow: 4px 4px 0 var(--ink);
}
button.secondary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
/* The web version's "Install app" button (pwa.js), on the yellow header; the downloaded file never shows it. */
.top-inner .install { margin-left: auto; flex: none; background: var(--card); }
@media (max-width: 560px) { .top-inner .install { margin-left: 0; } }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 0; }
.compare figure { margin: 0; }
.compare canvas { display: block; width: 100%; height: auto; border: 3px solid var(--ink); background: #fff; }
.compare figcaption { font-weight: 700; margin-top: 6px; }
