/* PaperKit web app. Colours are tokens; dark is the default look, light follows the system or the toggle. */
:root {
  --bg: #f6f7fb; --bg2: #ffffff; --card: #ffffff; --line: #e6e8ef; --text: #0f172a; --muted: #64748b; --soft: #f1f3f9;
  --brand: #e11d48; --brand2: #f97316; --ok: #16a34a; --err: #dc2626; --ring: #e11d4840;
  --shadow: 0 1px 2px #0f172a0d, 0 8px 28px #0f172a12; --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07080c; --bg2: #0d0f16; --card: #11141d; --line: #1f2533; --text: #eef2f8; --muted: #8b95a8; --soft: #161a25;
    --brand: #fb4d74; --brand2: #fb923c; --ring: #fb4d7450; --shadow: 0 1px 2px #0006, 0 12px 40px #0008;
  }
}
:root[data-theme="dark"] {
  --bg: #07080c; --bg2: #0d0f16; --card: #11141d; --line: #1f2533; --text: #eef2f8; --muted: #8b95a8; --soft: #161a25;
  --brand: #fb4d74; --brand2: #fb923c; --ring: #fb4d7450; --shadow: 0 1px 2px #0006, 0 12px 40px #0008;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: var(--brand); }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- top bar */
.pk-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.pk-logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: -.3px; }
.pk-logo img { border-radius: 8px; }
.pk-search { flex: 1; max-width: 460px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pk-search:hover { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.pk-search span { flex: 1; text-align: left; }
kbd { display: inline-flex; align-items: center; gap: 2px; font: 600 11px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; color: var(--muted); background: var(--soft); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text); flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--soft); border-color: var(--line); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--err); }
.btn-app { text-decoration: none; font-weight: 700; color: #fff; padding: 9px 14px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--brand2)); white-space: nowrap; }
.only-mobile { display: none; }

/* ---------- layout */
.pk-body { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 57px); }
.pk-side { position: sticky; top: 57px; height: calc(100vh - 57px); overflow: auto; padding: 16px 10px 20px; border-right: 1px solid var(--line); background: var(--bg2); }
.side-group { margin-bottom: 14px; }
.side-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.side-link:hover { background: var(--soft); }
.side-link.on { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 700; }
.side-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--soft); flex: none; }
.side-foot { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); padding: 10px; }
.pk-main { min-width: 0; padding: 26px clamp(16px, 4vw, 44px) 60px; }

/* ---------- home */
.hero { position: relative; text-align: center; padding: 40px 10px 34px; animation: rise .5s ease both; }
.hero-glow { position: absolute; inset: -40px 10% auto; height: 320px; background: radial-gradient(60% 60% at 50% 30%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 70%), radial-gradient(40% 50% at 70% 40%, color-mix(in srgb, var(--brand2) 25%, transparent), transparent 70%); filter: blur(30px); z-index: -1; pointer-events: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.hero h1 { font-size: clamp(36px, 6vw, 64px); line-height: 1.02; letter-spacing: -2px; margin: 18px 0 14px; }
.grad { background: linear-gradient(120deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 18px; margin: 0 auto 24px; max-width: 560px; }
.hero-drop { width: min(680px, 100%); display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 auto; padding: 34px 16px; border-radius: 22px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--card) 85%, transparent); cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; color: var(--brand); }
.hero-drop strong { font-size: 19px; color: var(--text); }
.hero-drop span { color: var(--muted); }
.hero-drop:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 0 0 6px var(--ring), var(--shadow); }
.suggest { width: min(680px, 100%); margin: 16px auto 0; text-align: left; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); animation: rise .3s ease both; }
.suggest-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 10px; }
.suggest-head span { display: inline-flex; gap: 6px; align-items: center; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { --tint: var(--brand); display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--tint) 35%, var(--line)); background: color-mix(in srgb, var(--tint) 9%, var(--card)); cursor: pointer; font-weight: 600; font-size: 14px; transition: transform .12s; }
.chip svg { color: var(--tint); }
.chip:hover { transform: translateY(-1px); border-color: var(--tint); }
.cat { margin-top: 30px; animation: rise .5s ease both; }
.cat h2 { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tcard { --tint: var(--brand); position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s; }
.tcard::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tint) 22%, transparent), transparent 70%); opacity: 0; transition: opacity .2s; }
.tcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--tint) 40%, var(--line)); }
.tcard:hover::after { opacity: 1; }
.tcard-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--tint); background: color-mix(in srgb, var(--tint) 13%, transparent); margin-bottom: 8px; }
.tcard strong { font-size: 16px; }
.tcard span { color: var(--muted); font-size: 13.5px; }
.tcard-go { position: absolute; top: 18px; right: 16px; color: var(--muted); opacity: 0; transform: translateX(-4px); transition: .18s; }
.tcard:hover .tcard-go { opacity: 1; transform: none; color: var(--tint); }

/* ---------- tool view */
.tool-view { animation: rise .35s ease both; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; font-weight: 600; }
.back:hover { color: var(--text); }
.tool-title { display: flex; align-items: center; gap: 14px; margin: 10px 0 20px; }
.tool-badge { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; flex: none; }
.tool-title h1 { margin: 0; font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -.8px; }
.tool-title p { margin: 2px 0 0; color: var(--muted); }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.workspace { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel.soft { box-shadow: none; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.inspector { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 42px 16px; border-radius: var(--radius); border: 2px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); background: var(--card); color: var(--brand); cursor: pointer; transition: .15s; }
.dropzone strong { color: var(--text); font-size: 17px; }
.dropzone span { color: var(--muted); }
.dropzone:hover { border-color: var(--brand); box-shadow: 0 0 0 5px var(--ring); }
.dropzone.compact { flex-direction: row; justify-content: center; padding: 12px; border-width: 1.5px; }
.dropzone.compact strong { font-size: 14px; }

.flist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.flist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: rise .25s ease both; }
.flist li.dragging { opacity: .4; }
.grip { color: var(--muted); cursor: grab; flex: none; }
.fnum { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); flex: none; }
.fthumb { position: relative; width: 46px; height: 58px; border-radius: 8px; overflow: hidden; background: var(--soft); display: grid; place-items: center; color: var(--muted); flex: none; border: 1px solid var(--line); }
.fthumb img { width: 100%; height: 100%; object-fit: cover; }
.fpages { position: absolute; right: 2px; bottom: 2px; font-size: 10px; font-weight: 700; background: #000b; color: #fff; padding: 0 4px; border-radius: 5px; }
.fmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fmeta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.fmeta span { color: var(--muted); font-size: 12.5px; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.ptile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; cursor: grab; transition: transform .15s, box-shadow .15s, border-color .15s; animation: rise .25s ease both; }
.ptile:hover { box-shadow: var(--shadow); }
.ptile.dragging { opacity: .35; }
.ptile.removed { border-color: var(--err); }
.ptile.removed img { opacity: .35; }
.pimg { position: relative; height: 150px; display: grid; place-items: center; background: var(--soft); border-radius: 9px; overflow: hidden; color: var(--muted); }
.pimg img { max-width: 92%; max-height: 92%; box-shadow: 0 2px 8px #0003; transition: transform .25s; background: #fff; }
.pmark { position: absolute; inset: 0; display: grid; place-items: center; color: var(--err); }
.pfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.pbtns { display: flex; gap: 2px; }
.pbtns button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.pbtns button:hover:not(:disabled) { background: var(--soft); }
.pbtns button:disabled { opacity: .3; }

/* ---------- options */
.field { margin-bottom: 14px; }
.field-label { font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); }
.seg button { flex: 1 1 auto; border: 0; background: transparent; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px #0002; }
.input { width: 100%; font-size: 15px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); outline: none; margin-bottom: 8px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.input.short { width: 110px; }
.input.area { resize: vertical; min-height: 160px; font-family: inherit; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; margin: 6px 0 12px; }
.toggle input { display: none; }
.toggle .track { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: .15s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px #0003; }
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track::after { left: 19px; }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2px var(--text); }

.cta { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 800; font-size: 16px; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 35%, transparent); transition: transform .12s, box-shadow .12s, opacity .12s; text-decoration: none; }
.cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px color-mix(in srgb, var(--brand) 45%, transparent); }
.cta:disabled { opacity: .45; cursor: default; box-shadow: none; }
.cta.small { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); transition: width .25s; }
.error { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); font-weight: 600; font-size: 14px; }
.batch-note { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.privacy { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); padding: 0 6px; }
.privacy svg { color: var(--ok); flex: none; }
.btn-ghost { border: 1px solid var(--line); background: var(--card); border-radius: 11px; padding: 8px 12px; cursor: pointer; font-weight: 600; }

/* ---------- results */
.results { margin-top: 20px; padding: 18px; border-radius: 22px; background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, color-mix(in srgb, var(--ok) 70%, transparent), color-mix(in srgb, var(--brand2) 50%, transparent)) border-box; border: 1.5px solid transparent; box-shadow: var(--shadow); animation: rise .35s ease both; }
.res-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.res-head > div { flex: 1; display: flex; flex-direction: column; }
.res-ok { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-weight: 900; animation: pop .45s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.res-diff { color: var(--ok); font-weight: 700; font-size: 14px; }
.res-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 420px; overflow: auto; }
.res-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 13px; background: var(--soft); }
.res-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.chain { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.chain > span { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 14px; }

/* ---------- palette & overlay */
.palette-wrap { position: fixed; inset: 0; z-index: 60; background: #0006; backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 14px 0; animation: rise .15s ease both; }
.palette { width: min(620px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px #0007; overflow: hidden; }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-in input { flex: 1; border: 0; outline: none; background: transparent; color: var(--text); font-size: 17px; }
.palette-list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; text-align: left; }
.palette-list button span:last-child { color: var(--muted); font-size: 13px; margin-left: auto; }
.palette-list button.on { background: var(--soft); }
.drop-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 18%, #000a); backdrop-filter: blur(6px); pointer-events: none; animation: rise .12s ease both; }
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; padding: 40px 60px; border: 3px dashed #fff9; border-radius: 28px; }
.drop-overlay strong { font-size: 24px; }

/* ---------- SEO text under the app */
.seo { max-width: 860px; margin: 0 auto; padding: 10px clamp(16px, 4vw, 44px) 60px; color: var(--muted); }
.seo h2 { color: var(--text); font-size: 20px; margin-top: 28px; }
.seo a { color: var(--brand); }
.seo-foot { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 18px; font-size: 13px; }
.seo-foot a { margin-right: 14px; color: var(--muted); }

/* ---------- small screens */
@media (max-width: 980px) {
  .tool-grid { grid-template-columns: 1fr; }
  .inspector { position: static; }
}
@media (max-width: 820px) {
  .only-mobile { display: inline-grid; }
  .pk-body { grid-template-columns: 1fr; }
  .pk-side { position: fixed; z-index: 40; top: 57px; left: 0; width: 280px; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  .menu-open .pk-side { transform: none; }
  .pk-search span, .pk-search kbd { display: none; }
  .pk-search { flex: 0; margin: 0 0 0 auto; }
  .btn-app { display: none; }
  .pk-top { gap: 6px; }
  .hero { padding-top: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
