:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1b1f27; --muted: #4f5866; --line: #d9dde4;
  --accent: #1f4fd8; --accent-ink: #fff; --warn-bg: #fff3d6; --warn-ink: #7a4d00; --err: #a1262b; --ok: #14663a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.top { background: #fff; border-bottom: 1px solid var(--line); padding: 20px 0 16px; }
h1 { font-size: clamp(1.45rem, 4.5vw, 2.1rem); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h3 { font-size: 1.05rem; margin: 22px 0 4px; }
.lead { margin: 0 0 10px; color: var(--muted); max-width: 70ch; }
.note { margin: 0; display: inline-block; background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 6px 10px; font-size: .92rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 16px 0; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .85rem; }
.muted { color: var(--muted); font-weight: 400; font-size: .95rem; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: .93rem; }
.sr-only, .sr-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.strip { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.strip li { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #eef0f4; }
.strip .thumb { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #eef0f4; }
.strip .cap { display: block; font-size: .72rem; padding: 2px 4px 3px; text-align: center; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .rm { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.72); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.strip .rm:hover { background: #000; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--accent); cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #173eb0; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover { background: #eef2ff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
:focus-visible { outline: 3px solid #ff9f1a; outline-offset: 2px; }
.sr-file:focus-visible + .btn { outline: 3px solid #ff9f1a; outline-offset: 2px; }
.msg { min-height: 1.4em; margin: 8px 0 0; font-size: .95rem; color: var(--ok); }
.msg.err { color: var(--err); font-weight: 600; }

.controls { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 640px) { .controls { grid-template-columns: auto 1fr 1fr; gap: 24px; } }
fieldset.seg { border: 0; margin: 0; padding: 0; display: flex; gap: 0; align-items: center; flex-wrap: wrap; }
fieldset.seg legend { padding: 0; margin-bottom: 6px; font-weight: 600; float: left; width: 100%; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { border: 1px solid var(--accent); padding: 9px 22px; min-height: 44px; cursor: pointer; color: var(--accent); font-weight: 600; background: #fff; }
.seg label:first-of-type { border-radius: 10px 0 0 10px; }
.seg label:last-of-type { border-radius: 0 10px 10px 0; border-left: 0; }
.seg input:checked + label { background: var(--accent); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid #ff9f1a; outline-offset: 2px; }
.range label { display: block; font-weight: 600; margin-bottom: 4px; }
.range input { width: 100%; min-height: 32px; accent-color: var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: #f0f3fb; border-radius: 10px; padding: 10px 12px; }
.tile b { display: block; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .88rem; }
.tile.bad { background: var(--warn-bg); } .tile.bad b { color: var(--warn-ink); }

.pages { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 16px 0 4px; }
@media (min-width: 560px) { .pages { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .pages { grid-template-columns: repeat(3, 1fr); } }
figure.pg { margin: 0; }
.sheet { position: relative; width: 100%; background: #fff; box-shadow: 0 2px 10px rgba(20,30,60,.22); outline: 1px solid #c9ced8; overflow: hidden; }
.sheet .frame { position: absolute; border: 1px dashed #c5cbe0; pointer-events: none; }
.sheet .ph { position: absolute; margin: 0; }
.sheet .ph img { width: 100%; height: 100%; display: block; object-fit: fill; }
.sheet .no { position: absolute; left: 3px; top: 3px; background: rgba(0,0,0,.72); color: #fff; font-size: .68rem; line-height: 1; padding: 3px 4px; border-radius: 4px; }
.sheet .ph.low { outline: 3px solid #e0a100; outline-offset: -3px; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: 6px; }
.empty { grid-column: 1 / -1; padding: 28px 12px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 12px; }

.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-weight: 600; }
table.report { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.report th, .report td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.report th { background: #f0f3fb; position: sticky; top: 0; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #def3e6; color: var(--ok); }
.chip.low { background: var(--warn-bg); color: var(--warn-ink); }
@media (max-width: 559px) { .report .opt { display: none; } .report th, .report td { padding: 6px 3px; font-size: .84rem; } }
.foot { color: var(--muted); font-size: .88rem; padding-bottom: 28px; }
@media (prefers-reduced-motion: no-preference) { .btn { transition: background .15s; } }
