/* PixelFree — hand-written CSS (no build step). Logical properties keep RTL working. */
:root {
  --bg: #f7f7fb; --surface: #fff; --surface-2: #f0effa; --text: #15142a; --muted: #5d5b78;
  --border: #e2e0f0; --brand: #6d4aff; --brand-2: #8f73ff; --brand-ink: #fff; --ok: #12a150; --warn: #c27a00; --err: #d93b3b;
  --radius: 14px; --shadow: 0 6px 24px rgba(30, 20, 90, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --checker: repeating-conic-gradient(#e9e8f2 0 25%, #fff 0 50%) 0 0 / 18px 18px;
  color-scheme: light;
}
.dark {
  --bg: #0f1020; --surface: #181a30; --surface-2: #20223d; --text: #ecebff; --muted: #a6a4c4;
  --border: #2c2e4d; --brand: #8f73ff; --brand-2: #a993ff; --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --checker: repeating-conic-gradient(#2a2c48 0 25%, #1d1f36 0 50%) 0 0 / 18px 18px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--brand); }
img, canvas { max-width: 100%; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.2; margin: .4em 0 .3em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .5em; }
.wrap { max-width: 1160px; margin-inline: auto; padding-inline: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.main-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem; }
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.lang-select, select, input[type=number], input[type=text] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.icon-btn { font-size: 1.2rem; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
@media (max-width: 640px) { .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; } }

/* badges, buttons */
.privacy-badge { display: inline-flex; gap: 8px; align-items: center; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: .92rem; margin: 0 0 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-2); }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: .88rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* tool */
.crumbs { font-size: .88rem; color: var(--muted); margin-top: 14px; }
.crumbs a { color: var(--muted); }
.tool-layout { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .tool-layout:has(.ad-side) { grid-template-columns: 1fr 300px; } }
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-height: 320px; min-width: 0; }
.tool-skeleton { height: 280px; border-radius: 12px; background: var(--surface-2); }
.drop { display: grid; place-items: center; text-align: center; gap: 6px; min-height: 240px; border: 2.5px dashed var(--border); border-radius: 14px; padding: 24px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.drop strong { font-size: 1.3rem; }
.drop small { color: var(--muted); }
.drop .drop-icon { font-size: 2.4rem; }
.drop.compact { min-height: 90px; padding: 12px; }
.options { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin: 14px 0; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.options label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: .92rem; }
.options input[type=range] { width: 140px; accent-color: var(--brand); }
.options input[type=number] { width: 90px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; border: 0; background: var(--surface); color: var(--text); padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.seg button[aria-pressed=true] { background: var(--brand); color: #fff; }
.notice { padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); margin: 10px 0; font-size: .93rem; }
.notice.err { background: color-mix(in srgb, var(--err) 14%, transparent); }

.files { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.file { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.file .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--checker); }
.file .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .meta { color: var(--muted); font-size: .86rem; }
.file .meta .good { color: var(--ok); font-weight: 700; }
.file .meta .bad { color: var(--err); font-weight: 700; }
.file .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .file { grid-template-columns: 52px 1fr; } .file .thumb { width: 52px; height: 52px; } .file .actions { grid-column: 1 / -1; justify-content: stretch; } .file .actions .btn { flex: 1; } }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .2s; }
.progress.indeterminate > i { width: 35%; animation: indet 1.1s infinite ease-in-out; }
@keyframes indet { from { margin-inline-start: -35%; } to { margin-inline-start: 100%; } }
.toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* background remover result */
.bg-results { display: grid; gap: 16px; margin-top: 14px; }
.bg-item { border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.compare { position: relative; border-radius: 10px; overflow: hidden; background: var(--checker); max-height: 70vh; display: grid; place-items: center; --pos: 50%; touch-action: pan-y; }
.compare canvas, .compare img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.compare .before { position: absolute; inset: 0; width: 100%; height: 100%; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare { direction: ltr; }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare .tag { position: absolute; top: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: .78rem; pointer-events: none; }
.compare .tag.b { left: 8px; } .compare .tag.a { right: 8px; }
.bg-item .row { margin-top: 10px; justify-content: space-between; }
.status { color: var(--muted); font-size: .9rem; }
.swatch { width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; }

/* refine modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(8, 8, 20, .78); display: grid; grid-template-rows: auto 1fr; }
.modal-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface); }
.modal-stage { overflow: auto; display: grid; place-items: center; padding: 12px; touch-action: none; }
.modal-stage canvas { background: var(--checker); cursor: crosshair; max-width: 100%; max-height: calc(100vh - 120px); touch-action: none; }

/* ads — fixed reserved heights prevent layout shift (CLS) */
.ad { display: block; margin: 16px auto; text-align: center; }
.ad-label { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.ad-top { max-width: 970px; min-height: 120px; padding-inline: 16px; }
.ad-side { min-height: 280px; margin: 0; }
.ad-content { min-height: 280px; }
.ad-processing { min-height: 120px; }
.ad-placeholder { height: calc(100% - 16px); min-height: inherit; display: grid; place-items: center; border: 2px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: .8rem; background: var(--surface-2); }
.ad-top .ad-placeholder { min-height: 100px; } .ad-side .ad-placeholder, .ad-content .ad-placeholder { min-height: 250px; } .ad-processing .ad-placeholder { min-height: 100px; }
.processing-ad { margin-top: 10px; }
.sticky-mobile { display: none; }
@media (max-width: 1023px) {
  .ad-side { min-height: 120px; } .ad-side .ad-placeholder { min-height: 100px; }
  .sticky-mobile { display: block; position: fixed; inset-inline: 0; bottom: 0; margin: 0; height: 66px; background: var(--surface); border-top: 1px solid var(--border); z-index: 30; overflow: hidden; }
  .sticky-mobile .ad-label { display: none; }
  .sticky-mobile .ad-placeholder { min-height: 50px; height: 50px; margin: 8px; }
  body:has(.sticky-mobile) { padding-bottom: 66px; }
}

/* content */
.content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 22px 22px; margin-top: 24px; }
.content .lead, .hero .lead { font-size: 1.12rem; color: var(--muted); }
.content li { margin: 4px 0; }
.faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.related { margin: 26px 0; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: .9rem; }
.hero { text-align: center; padding: 30px 0 10px; }
.tool-group h2 { margin-top: 1.4em; }
.cards { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { display: grid; gap: 4px; padding: 16px; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.card span { color: var(--muted); font-size: .88rem; }
.prose { max-width: 780px; padding-block: 10px 40px; }

/* footer */
.site-footer { margin-top: 40px; background: var(--surface); border-top: 1px solid var(--border); padding: 24px 0; font-size: .9rem; }
.footer-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-grid h3 { font-size: 1rem; margin: 0 0 6px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid a, .footer-links a { color: var(--muted); text-decoration: none; }
.footer-grid a:hover, .footer-links a:hover { color: var(--brand); }
.footer-note, .copy { color: var(--muted); }

/* toasts */
.toasts { position: fixed; bottom: 80px; inset-inline-end: 16px; display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; max-width: 320px; animation: tin .2s ease-out; }
.toast.err { background: var(--err); color: #fff; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
