:root {
  --bg: #fafaf9; --surface: #ffffff; --fg: #1c1917; --muted: #57534e; --line: #e7e5e4;
  --accent: #e11d48; --accent-hover: #be123c; --accent-soft: #fff1f2; --ok: #15803d; --err: #b91c1c;
  --radius: 14px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a09; --surface: #1c1917; --fg: #f5f5f4; --muted: #a8a29e; --line: #292524;
    --accent: #fb7185; --accent-hover: #fda4af; --accent-soft: #2a1519; --ok: #4ade80; --err: #f87171; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.top nav { display: flex; gap: 14px; font-size: 14px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--fg); }

h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.12; letter-spacing: -.02em; margin: 28px 0 10px; }
.lead { color: var(--muted); font-size: 18px; margin: 0 0 22px; max-width: 60ch; }
h2 { font-size: 22px; margin: 48px 0 14px; }

#tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 190px;
  border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; text-align: center; padding: 20px; transition: .15s; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop.compact { min-height: 0; flex-direction: row; padding: 12px; }
.drop-btn { background: var(--accent); color: #fff; font-weight: 700; padding: 12px 22px; border-radius: 10px; font-size: 17px; white-space: nowrap; }
.drop.compact .drop-btn { padding: 8px 14px; font-size: 15px; }
.drop-hint { color: var(--muted); font-size: 14px; }

.files { list-style: none; margin: 14px 0 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--bg); }
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { color: var(--muted); font-size: 14px; }
.fsize em { font-style: normal; color: var(--ok); }
.handle { cursor: grab; color: var(--muted); user-select: none; }
.note { flex-basis: 100%; color: var(--muted); }
button { font: inherit; color: inherit; }
.x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.x:hover { color: var(--err); background: var(--accent-soft); }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.opt label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.opt-control { display: flex; align-items: center; gap: 8px; }
.opt select, .opt input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; }
.opt input[type=range] { padding: 0; accent-color: var(--accent); }
.opt output { min-width: 3.2em; text-align: right; color: var(--muted); }

.go { display: block; width: 100%; margin-top: 16px; padding: 14px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; }
.go:hover:not(:disabled) { background: var(--accent-hover); }
.go:disabled { opacity: .45; cursor: not-allowed; }
.go.zip { background: var(--fg); color: var(--bg); }
.status { min-height: 1.6em; margin: 10px 0 0; color: var(--muted); }
.status.error { color: var(--err); font-weight: 600; }
.results .files.out li { background: var(--surface); }
.dl { background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; padding: 6px 14px; border-radius: 8px; }
.dl:hover { background: var(--accent-hover); }
.link { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; }

.page-tools { margin: 14px 0 8px; }
.page-tools button, .page-bar button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.page { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); cursor: grab; }
.thumb { aspect-ratio: 1 / 1.3; display: grid; place-items: center; overflow: hidden; }
.thumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: transform .2s; background: #fff; }
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 6px; font-size: 13px; }
.page-bar button { padding: 2px 7px; }
.page.deleted .thumb { opacity: .2; }
.page.deleted { border-style: dashed; }
.page.deleted .x { color: var(--err); }

.privacy { display: flex; gap: 8px; align-items: center; color: var(--ok); font-size: 14px; margin: 12px 0 0; }
.tip { color: var(--muted); font-size: 15px; }
ol.how { padding-left: 22px; } ol.how li { margin: 4px 0; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 8px 0 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.card { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; transition: .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 19px; font-weight: 700; }
.card b { display: block; font-size: 15px; }
.group-title { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; }

footer { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

.fb-open { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 2px 12px; cursor: pointer; font-size: 14px; color: var(--fg); }
.fb-open:hover { border-color: var(--accent); }
dialog.fb { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); padding: 22px; }
dialog.fb::backdrop { background: rgba(0, 0, 0, .45); }
.fb h2 { margin: 0 0 4px; }
.fb .opt { display: block; margin-top: 12px; }
.fb .opt span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.fb textarea, .fb input[type=email] { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; resize: vertical; }
.fb-kinds { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.fb-kinds input { accent-color: var(--accent); }
.fb-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.fb-actions .go { width: auto; margin: 0; padding: 10px 24px; }
.fb-actions .link { margin: 0; }
