:root {
  --paper: #f3ebdd;
  --surface: #fbf7f0;
  --ink: #171419;
  --muted: #5d5660;
  --line: #ddd2c1;
  --accent: #1f5c4a;
  --accent-ink: #ffffff;
  --lost: #9b2c1f;
  --manual: #8a5a00;
  --check: #2f4f8a;
  --ok: #1f6b3a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151316; --surface: #1e1b20; --ink: #efe8dc; --muted: #a9a1a9; --line: #353037;
    --accent: #6fc2a5; --accent-ink: #0d1f19; --lost: #ff8a7a; --manual: #f0b85a; --check: #8fb0f0; --ok: #7fd49a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151316; --surface: #1e1b20; --ink: #efe8dc; --muted: #a9a1a9; --line: #353037;
  --accent: #6fc2a5; --accent-ink: #0d1f19; --lost: #ff8a7a; --manual: #f0b85a; --check: #8fb0f0; --ok: #7fd49a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; padding-bottom: 8px; }
.brand { font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
a { color: var(--accent); }
.quiet { color: var(--muted); font-size: 14px; }
.hero { padding: 40px 0 24px; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 14px; max-width: 18ch; }
h2 { font-size: 22px; margin: 0 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 20px 0 8px; }
.lede { font-size: 19px; max-width: 60ch; margin: 0 0 22px; }
.scan { display: flex; gap: 8px; max-width: 620px; }
input[type="text"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; width: 100%;
}
textarea { font-family: var(--mono); font-size: 13px; }
.scan input { font-size: 17px; padding: 13px 14px; }
button {
  font: inherit; font-weight: 600; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
button.ghost { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.55; cursor: progress; }
.scan button { padding: 13px 20px; }
.fine, .muted { color: var(--muted); }
.fine { font-size: 14px; max-width: 62ch; }
.small { font-size: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 18px 0; }
.status-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.error { color: var(--lost); font-weight: 600; margin: 12px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.opts { display: grid; gap: 8px; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.table-wrap { overflow-x: auto; }
table.rules { width: 100%; border-collapse: collapse; font-size: 14px; }
.rules th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rules td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rules input { font-family: var(--mono); font-size: 13px; padding: 6px 8px; min-width: 190px; }
.rules .ex { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
details { margin-top: 14px; }
summary { cursor: pointer; font-weight: 600; }
code { font-family: var(--mono); font-size: 0.9em; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--paper); display: flex; flex-direction: column; }
.card h3 { margin-top: 0; }
.card .btns { margin-top: auto; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.warnings { padding-left: 18px; color: var(--manual); font-size: 13px; margin: 0 0 10px; }
.preview { font-family: var(--mono); font-size: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 320px; overflow: auto; white-space: pre; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; background: var(--paper); }
.checklist .lvl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 6px; }
.checklist li.lost { border-left-color: var(--lost); } .checklist li.lost .lvl { color: var(--lost); }
.checklist li.manual { border-left-color: var(--manual); } .checklist li.manual .lvl { color: var(--manual); }
.checklist li.check { border-left-color: var(--check); } .checklist li.check .lvl { color: var(--check); }
.checklist li.ok { border-left-color: var(--ok); } .checklist li.ok .lvl { color: var(--ok); }
.checklist p { margin: 4px 0 0; font-size: 14px; }
.checklist .ex { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; word-break: break-all; }
.next p { max-width: 62ch; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.prose { max-width: 68ch; }
.prose pre { font-family: var(--mono); font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
@media (max-width: 720px) {
  .grid2, .cards { grid-template-columns: 1fr; }
  .scan { flex-direction: column; }
  .hero { padding-top: 24px; }
}
