:root {
  --img: #2563eb; --img-soft: #eff4ff;
  --pdf: #dc2626; --pdf-soft: #fef1f1;
  --ink: #1a1d24; --muted: #5f6673; --line: #e3e6ec; --bg: #f6f7f9; --card: #fff;
  --ok: #15803d; --warn: #b45309;
  --r: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
a { color: var(--img); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.2; }
[hidden] { display: none !important; }

/* header / footer */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo::first-letter { color: var(--img); }
.top nav { display: flex; gap: 18px; flex-wrap: wrap; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.top nav a:hover { color: var(--img); }
.foot { margin-top: 64px; padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.foot a { color: var(--muted); }

/* hero */
.hero { text-align: center; padding: 40px 0 16px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 0 0 10px; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto; }

/* home grid */
.group { font-size: 1.05rem; color: var(--muted); margin: 32px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 30, 60, .08); }
.card h3 { margin: 12px 0 4px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }
.ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.img { background: var(--img-soft); color: var(--img); }
.ico.pdf { background: var(--pdf-soft); color: var(--pdf); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.btn-big { font-size: 1.15rem; padding: 16px 40px; min-height: 56px; }
.btn.img { background: var(--img); }
.btn.pdf { background: var(--pdf); }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn.busy::before { content: ""; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; color: var(--img); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; }
:focus-visible { outline: 3px solid #93b4ff; outline-offset: 2px; }

/* drop zone */
.pick { text-align: center; margin: 8px 0 24px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 16px; border: 2px dashed var(--line); border-radius: var(--r); background: var(--card); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--img); background: var(--img-soft); }
.pick.compact .drop { padding: 16px; flex-direction: row; justify-content: center; }
.pick.compact .btn-big { font-size: 1rem; padding: 10px 20px; min-height: 0; }
.hint { color: var(--muted); }
.privacy { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; margin: 12px 0 0; }
.privacy svg { width: 16px; height: 16px; fill: none; stroke: var(--ok); stroke-width: 2; }

/* work area */
.work { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; margin-bottom: 24px; }
@media (max-width: 760px) { .work { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.thumb.doc { display: grid; place-items: center; font-size: .75rem; font-weight: 800; color: var(--pdf); background: var(--pdf-soft); }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; min-width: 0; }
.fsize { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.acts { display: flex; gap: 4px; }
.acts button { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer; font-size: .95rem; }
.acts button:hover:not(:disabled) { background: var(--bg); }
.acts button:disabled { opacity: .35; cursor: default; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; position: sticky; top: 16px; }
.panel .btn { width: 100%; margin-top: 18px; }
.lbl { display: block; font-weight: 700; margin: 14px 0 8px; }
.lbl:first-child { margin-top: 0; }
.panel input:not([type]), .panel input[inputmode], .panel select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row select { width: auto; }
.mini { flex: 1; font-size: .85rem; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .chips a { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink); text-decoration: none; }
.chips button.on { border-color: var(--img); background: var(--img-soft); color: var(--img); font-weight: 700; }
.chips a:hover { border-color: var(--img); color: var(--img); }
.note { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.status { color: var(--muted); font-size: .9rem; min-height: 1.4em; margin: 10px 0 0; text-align: center; }
.error { background: var(--pdf-soft); color: #991b1b; border: 1px solid #fecaca; border-radius: 12px; padding: 12px 16px; }

/* results */
.results { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 28px 20px; text-align: center; }
.results h2 { margin: 0 0 6px; }
.saved { font-size: 1.2rem; margin: 0 0 16px; }
.saved span { color: var(--ok); font-weight: 800; margin-left: 6px; }
.results .list { text-align: left; margin: 20px auto 8px; max-width: 720px; }
.results .list li { grid-template-columns: 1fr auto auto; }
.fnote { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; }
.list li.miss .fnote { color: var(--warn); }

/* before / after */
.ba { --x: 50%; position: relative; max-width: 720px; margin: 0 auto 20px; border-radius: 12px; overflow: hidden; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 20px 20px; user-select: none; }
.ba img { display: block; width: 100%; max-height: 460px; object-fit: contain; }
.ba .after { position: absolute; inset: 0; height: 100%; clip-path: inset(0 0 0 var(--x)); }
.ba .bar { position: absolute; top: 0; bottom: 0; left: var(--x); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.4); pointer-events: none; }
.ba .bar::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 6px rgba(0,0,0,.3); color: var(--ink); }
.ba input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.ba .tag { position: absolute; top: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.ba .tag.l { left: 10px; } .ba .tag.r { right: 10px; }

/* ads (replace inner text with ad code) */
.ad { display: grid; place-items: center; min-height: 90px; margin: 16px 0; border: 1px dashed var(--line); border-radius: 12px; color: #b3b8c2; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }

/* content */
.sizes, .info { margin-top: 40px; }
.sizes h2, .info h2 { font-size: 1.25rem; }
.info ol { padding-left: 20px; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 8px; }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 10px 0 0; color: var(--muted); }
