:root {
  --brand: #5b3df5;
  --brand-dark: #4327d6;
  --accent: #ff6b4a;
  --ink: #1b1d2e;
  --muted: #6b7086;
  --line: #e5e6ef;
  --bg: #f6f6fb;
  --card: #fff;
  --ok: #17a36b;
  --err: #d93a3a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 50, .05), 0 6px 20px rgba(20, 20, 50, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
img, canvas { max-width: 100%; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; padding-bottom: 60px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--err); }
.ok { color: var(--ok); }
.hl { background: linear-gradient(90deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
code.code { background: #efeafe; color: var(--brand-dark); padding: 3px 8px; border-radius: 6px; font-size: 15px; letter-spacing: .5px; }

/* ---------------- header / footer */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--brand); font-weight: 800; }
.brand.small { font-size: 15px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--ink); padding: 8px 12px; border-radius: 8px; font-size: 15px; white-space: nowrap; }
.nav a:hover, .nav a.active { background: #f0edff; color: var(--brand-dark); text-decoration: none; }
.pill { display: inline-block; padding: 6px 12px; border-radius: 99px; font-size: 14px; font-weight: 600; }
.pill-premium { background: linear-gradient(90deg, #ffcf4a, #ff9d3a); color: #4b2a00; }
.site-footer { background: #fff; border-top: 1px solid var(--line); padding: 30px 0 10px; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.footer-links a { color: var(--muted); }
.copyright { margin-top: 20px; }

/* ---------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s; color: var(--ink); background: #fff; text-decoration: none !important; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(91, 61, 245, .3); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { background: #f4f3fb; }
.btn-link { background: none; color: var(--brand); padding: 6px 8px; font-weight: 500; }
.btn-lg { padding: 15px 28px; font-size: 18px; border-radius: 12px; }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-khalti { background: #5c2d91; color: #fff; }
.btn-khalti:hover { background: #4a2376; }

/* ---------------- home */
.boot { display: flex; justify-content: center; padding: 120px 0; }
.hero { text-align: center; padding: 50px 0 20px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -1px; }
.hero p { color: var(--muted); font-size: 18px; max-width: 680px; margin: 0 auto 26px; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 16px; font: inherit; font-size: 15px; cursor: pointer; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 26px 0; }
.tool-grid.small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tool-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); text-decoration: none; }
.tool-card h3 { font-size: 18px; margin: 14px 0 6px; }
.tool-card p { color: var(--muted); font-size: 14px; margin: 0; }
.tool-icon { display: inline-flex; width: 48px; height: 48px; border-radius: 12px; align-items: center; justify-content: center; color: #fff; background: var(--c, var(--brand)); }
.tool-icon svg { width: 28px; height: 28px; }
.tool-icon.big { width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0; }
.tool-icon.big svg { width: 36px; height: 36px; }
.badge-premium { display: inline-block; font-size: 12px; font-weight: 700; color: #7a4a00; background: #fff1cc; border: 1px solid #ffd970; border-radius: 99px; padding: 2px 9px; vertical-align: middle; }
.tool-card .badge-premium { position: absolute; top: 16px; right: 16px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 40px; }
.features > div { background: #fff; border-radius: var(--radius); padding: 22px; border: 1px solid var(--line); }
.features h3 { font-size: 17px; }
.features p { margin: 0; color: var(--muted); }

/* ---------------- tool page */
.tool-page { padding-top: 30px; }
.tool-head { display: flex; gap: 18px; align-items: center; margin-bottom: 26px; }
.tool-head h1 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 4px; }
.tool-head p { margin: 0; color: var(--muted); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 300px; border: 2px dashed color-mix(in srgb, var(--c) 45%, #fff); border-radius: 20px; background: color-mix(in srgb, var(--c) 5%, #fff); cursor: pointer; padding: 30px; text-align: center; transition: background .15s; }
.dropzone:hover, .dropzone.drag { background: color-mix(in srgb, var(--c) 12%, #fff); }
.dropzone .btn-primary { background: var(--c); box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 35%, transparent); }
.note { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 16px auto; max-width: 720px; white-space: pre-wrap; font-family: inherit; }
.workspace { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.ws-main { min-height: 300px; border-radius: 16px; }
.ws-main.drag { outline: 2px dashed var(--c); }
.ws-side { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; position: sticky; top: 84px; }
.ws-side h2 { font-size: 20px; }
.ws-side .run { background: var(--c); box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 35%, transparent); margin-top: 10px; }
.ws-error { color: var(--err); font-size: 14px; min-height: 4px; margin: 8px 0; }
.field { display: block; margin-bottom: 16px; }
.field .label { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field input[type=password] { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfe; }
.field input:focus { outline: 2px solid color-mix(in srgb, var(--c, var(--brand)) 40%, transparent); border-color: transparent; }
.field input[type=color] { width: 56px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.field input[type=range] { width: 100%; accent-color: var(--c); }
.field.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.field.check input { margin-top: 3px; accent-color: var(--c); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; border: 1px solid var(--line); background: #fbfbfe; border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.seg button.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); font-weight: 600; }
.list-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; width: 100%; }
.range-input input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; width: 170px; }
.file-list { display: flex; flex-wrap: wrap; gap: 14px; align-content: flex-start; }
.file-card, .page-card { position: relative; width: 170px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; user-select: none; transition: box-shadow .15s, border-color .15s, opacity .15s; }
.file-card[draggable=true], .page-card[draggable=true] { cursor: grab; }
.file-card .thumb, .page-card .thumb { height: 190px; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: transform .2s; }
.file-card .thumb canvas, .file-card .thumb img, .page-card .thumb canvas { max-height: 190px; max-width: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); object-fit: contain; }
.thumb-err { font-size: 40px; opacity: .4; }
.fname { font-size: 13px; font-weight: 600; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.file-card:hover .card-actions, .page-card:hover .card-actions { opacity: 1; }
@media (hover: none) { .card-actions { opacity: 1; } }
.card-actions button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.card-actions button:hover { background: #f2f0ff; }
.dragging { opacity: .4; }
.drop-target { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); }
.page-grid .pages { display: flex; flex-wrap: wrap; gap: 14px; }
.page-card { width: 150px; cursor: pointer; }
.page-card .thumb { height: 170px; }
.page-card .thumb canvas { max-height: 170px; }
.page-card .pno { font-size: 13px; color: var(--muted); margin-top: 6px; }
.page-card.selected { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); }
.page-card.selected::after { content: "✓"; position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; font-size: 14px; line-height: 24px; }
.page-card.mode-remove.selected::after { content: "✕"; background: var(--err); }
.page-card.mode-remove.selected .thumb { opacity: .45; }
.page-card.deleted { opacity: .4; }
.page-card.deleted .thumb { filter: grayscale(1); }

/* ---------------- result */
.result { text-align: center; padding: 30px 0; }
.result-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 38px; line-height: 72px; margin: 0 auto 16px; }
.result .download { background: var(--c); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.next-tools { margin-top: 40px; text-align: left; }
.ad-slot { margin: 20px auto; max-width: 970px; min-height: 0; }

/* ---------------- overlays / modals */
.overlay { position: fixed; inset: 0; background: rgba(20, 20, 40, .55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.progress-box, .modal { background: #fff; border-radius: 18px; padding: 30px; width: 100%; max-width: 440px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); position: relative; }
.modal { max-width: 520px; text-align: left; }
.modal-x { position: absolute; top: 12px; right: 12px; border: 0; background: #f1f1f6; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.bar { height: 8px; background: #eeedf7; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .3s; }
.gate-options { display: grid; gap: 12px; margin-top: 18px; }
.gate-opt { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; text-align: left; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 14px 16px; cursor: pointer; font: inherit; color: var(--ink); }
.gate-opt:hover:not(:disabled) { border-color: var(--brand); background: #faf8ff; text-decoration: none; }
.gate-opt:disabled { opacity: .5; cursor: not-allowed; }
.gate-ico { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; background: var(--brand); }
.gate-opt.premium .gate-ico { background: linear-gradient(135deg, #ffb43a, #ff7a3a); }
.house-ad { text-align: center; }
.house-ad img { max-height: 220px; border-radius: 10px; margin-bottom: 12px; }
.ad-label { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; margin-bottom: 12px; }
.countdown { margin: 22px 0 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 200; transition: all .3s; max-width: calc(100% - 40px); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #e3e1f3; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
.spinner.big { width: 44px; height: 44px; border-width: 4px; margin-bottom: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- premium */
.premium-page { max-width: 900px; margin: 0 auto; padding-top: 40px; text-align: center; }
.premium-page h1 { font-size: clamp(30px, 5vw, 42px); }
.lead { font-size: 18px; color: var(--muted); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 20px 0; }
.active-plan { border-color: #ffd970; background: #fffbea; }
.compare table { width: 100%; border-collapse: collapse; }
.compare td, .compare th { padding: 12px; border-bottom: 1px solid var(--line); }
.compare td:first-child { text-align: left; }
.compare th:last-child, .compare td:last-child { color: var(--brand-dark); font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan { position: relative; margin: 0; }
.plan.featured { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 99px; }
.price { font-size: 32px; font-weight: 800; margin: 6px 0; }
.redeem-form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.redeem-form input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; text-transform: uppercase; letter-spacing: 1px; min-width: 0; }

/* ---------------- prose */
.prose { max-width: 760px; margin: 40px auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; }
.prose li { margin-bottom: 6px; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .ws-side { position: static; }
  .nav a:not(:first-child):not(:last-child) { display: none; }
}
@media (max-width: 520px) {
  .header-inner { gap: 10px; justify-content: space-between; }
  .nav { display: none; }
  .brand span { font-size: 16px; }
  .file-card { width: calc(50% - 7px); }
  .page-card { width: calc(33.3% - 10px); padding: 6px; }
  .page-card .thumb { height: 120px; }
  .page-card .thumb canvas { max-height: 120px; }
  .tool-head { flex-direction: column; text-align: center; }
  .prose { padding: 22px; }
}

/* ---------------- ad blocker wall */
.adblock-wall { max-width: 640px; margin: 50px auto; text-align: center; }
.adblock-icon { font-size: 56px; margin-bottom: 10px; }
.adblock-steps { text-align: left; }
.adblock-steps ol { padding-left: 20px; }
.adblock-steps li { margin-bottom: 8px; }
.adblock-steps .btn { width: 100%; margin-top: 10px; }


/* ---------------- SEO content */
.crumbs { padding-top: 16px; }
.crumbs a { color: var(--muted); }
.seo { max-width: 860px; margin: 48px auto 0; }
.seo h2 { font-size: 24px; margin: 34px 0 12px; }
.seo h3 { font-size: 17px; margin: 20px 0 4px; }
.seo p { margin: 0 0 12px; }
.seo .lead-in { font-size: 17px; }
.seo ol { padding-left: 22px; margin: 0; }
.seo li { margin-bottom: 8px; }
.seo details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.seo summary { font-weight: 600; cursor: pointer; }
.seo details p { margin: 10px 0 0; color: var(--muted); }
.footer-about { max-width: 260px; }
.footer-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 20px; flex: 1; min-width: 280px; }
.footer-tools h2 { font-size: 14px; margin-bottom: 8px; }
.footer-tools a { display: block; color: var(--muted); font-size: 14px; padding: 3px 0; }
.plan-name { font-size: 18px; }
