@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/readex-pro-arabic-wght-normal.woff2") format("woff2"); font-weight: 160 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Spline Sans Mono"; src: url("fonts/spline-sans-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --ground: #e9eef3;
  --card: #ffffff;
  --ink: #16202a;
  --soft: rgb(22 32 42 / 0.6);
  --line: rgb(22 32 42 / 0.12);
  --accent: #ff4f00;
  --on-accent: #ffffff;
  --check-a: #d5dce3;
  --check-b: #f4f6f8;
  --bad: #c2410c;
  --display: var(--ui);
  --ui: "Manrope", "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Spline Sans Mono", "Readex Pro", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --ground: #14181d; --card: #1d232a; --ink: #e6ecf2; --soft: rgb(230 236 242 / 0.62); --line: rgb(230 236 242 / 0.12); --accent: #ff6a26; --on-accent: #1a0c04; --check-a: #262d35; --check-b: #1d232a; --bad: #fb923c; color-scheme: dark; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 500 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.primary { padding: 9px 16px; border: 0; background: var(--accent); color: var(--on-accent); }
.ghost { padding: 8px 14px; border: 1px solid var(--line); background: transparent; }
.ghost:hover { border-color: var(--ink); }
.small { padding: 6px 12px; font-size: 14px; }

/* The tool fills the window; the questions come after it */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
@media (min-width: 900px) and (min-height: 640px) { .app { height: 100dvh; } }
.bar { display: flex; align-items: baseline; gap: 4px 20px; flex-wrap: wrap; padding: 16px 28px 8px; }
.brand { margin: 0; font: 800 28px/1 var(--ui); letter-spacing: -0.04em; }
.brand span { color: var(--accent); }
.purpose { flex: 1; margin: 0; color: var(--soft); font-size: 16px; }
.bar-meta { color: var(--soft); font-size: 13px; }

/* Settings: chips in one line */
.controls { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; padding: 8px 28px 14px; }
.group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.group.end { margin-inline-start: auto; }
.label { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { padding: 7px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 700; }
.chips button small { font-weight: 500; color: var(--soft); }
.chips button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--ground); }
.chips button[aria-pressed="true"] small { color: inherit; opacity: 0.75; }
.chips input { width: 170px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 600; }
.chips input:not(:placeholder-shown) { border-color: var(--ink); }
/* "1.00 MB" read backwards ("MB 1.00") in the Arabic page. */
[dir="rtl"] .chips input:not(:placeholder-shown) { direction: ltr; text-align: right; }
.chips input.bad { border-color: var(--bad); }

/* The light table */
.table { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 0 28px 24px; overflow-y: auto; }
.drop { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 260px; padding: 28px; border: 2px dashed var(--line); border-radius: 10px; text-align: center; cursor: pointer;
  background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 28px 28px; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.over { background-size: 22px 22px; }
.drop-title { padding: 6px 14px; border-radius: 10px; background: var(--card); font: 800 clamp(24px, 3.4vw, 40px)/1.15 var(--ui); letter-spacing: -0.03em; }
.drop-title u { text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.drop-sub, .drop-note { max-width: 52ch; padding: 4px 10px; border-radius: 8px; background: var(--card); color: var(--soft); }
.drop-note { font-weight: 700; color: var(--ink); }
/* With photos in the list, the drop zone moves below them and fills what's left: room for more */
.drop.compact { order: 2; flex: 1 0 auto; min-height: 96px; padding: 14px; grid-auto-flow: column; gap: 14px; }
.list { order: 1; }
.drop.compact .drop-title { font-size: 18px; }
.drop.compact .drop-sub { display: none; }

.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.row { display: grid; grid-template-columns: 56px minmax(120px, 1.2fr) auto auto minmax(160px, 2fr) auto 28px; align-items: center; gap: 6px 16px; padding: 8px 10px 8px 8px; border-radius: 10px; background: var(--card); }
.thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 12px 12px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.sizes { font: 500 16px var(--mono); white-space: nowrap; }
.sizes s { color: var(--soft); text-decoration-thickness: 1px; }
.sizes b { font-weight: 700; }
.badge { padding: 3px 9px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font: 700 14px var(--mono); transform: rotate(-3deg); }
.badge.miss { background: var(--bad); }
.detail { color: var(--soft); font-size: 13.5px; }
.detail em { font-style: normal; color: var(--ink); }
.row > .error { grid-column: 3 / 7; color: var(--bad); font-weight: 600; }
.row.working .detail::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--accent); animation: blink 0.8s ease-in-out infinite alternate; }
.row-actions { display: flex; gap: 6px; }
.x { width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--soft); font-size: 20px; line-height: 1; }
.x:hover { background: var(--line); color: var(--ink); }
@keyframes blink { to { opacity: 0.25; } }

/* Compare */
.compare { width: min(1100px, 94vw); height: min(780px, 92dvh); padding: 0; border: 0; border-radius: 12px; background: var(--card); color: var(--ink); overflow: hidden; }
.compare[open] { display: flex; flex-direction: column; }
.compare::backdrop { background: rgb(10 14 18 / 0.6); }
.compare-bar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.compare-bar b { flex: 1; font-family: var(--mono); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoom-hint { color: var(--soft); font-size: 13px; }
@media (max-width: 600px) {
  .compare-bar { flex-wrap: wrap; gap: 6px 12px; }
  .compare-bar b { flex-basis: 100%; }
  .zoom-hint { flex: 1; }
}
.view { position: relative; flex: 1; min-height: 0; display: flex; }
.stage { flex: 1; min-height: 0; overflow: auto; container-type: size; display: grid; place-items: center; background: repeating-conic-gradient(var(--check-a) 0 25%, var(--check-b) 0 50%) 0 0 / 20px 20px; }
/* The pair is exactly the picture, so the line's position means the same place in both views */
.pair { position: relative; aspect-ratio: var(--ratio, 4 / 3); width: min(100cqw, 100cqh * var(--ratio, 1.333)); cursor: ew-resize; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pair img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pair #after-img { clip-path: inset(0 0 0 var(--split, 50%)); }
.pair::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; margin-left: -1px; background: var(--accent); pointer-events: none; }
/* The handle sits on the line, in the middle of what you can see; drag it, or tap anywhere on the picture */
.handle { position: absolute; z-index: 1; top: var(--handle-y, 50%); left: var(--split, 50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 3px solid var(--accent); border-radius: 50%; background: var(--card); color: var(--accent); font: 800 18px/1 var(--ui); letter-spacing: -0.1em; transform: translate(-50%, -50%); cursor: ew-resize; touch-action: none; box-shadow: 0 2px 10px rgb(0 0 0 / 0.3); }
.handle:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Zoomed: the picture at its real size, scrolled to where you double-clicked */
.stage.zoomed { place-items: start; }
.stage.zoomed .pair { width: var(--w); }
/* The labels belong to the window, not the picture, so they stay in the corners even at 100% */
.tag { position: absolute; top: 10px; z-index: 2; padding: 3px 8px; border-radius: 6px; background: var(--ink); color: var(--ground); font-size: 12px; font-weight: 800; pointer-events: none; }
.tag.left { left: 10px; }
.tag.right { right: 10px; background: var(--accent); color: var(--on-accent); }

.toast { position: fixed; left: 50%; bottom: 24px; margin: 0; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--ground); font-weight: 700; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } .row.working .detail::before { animation: none; } }
@media (max-width: 899px) {
  .bar, .controls { padding-inline: 16px; }
  .purpose { flex-basis: 100%; order: 3; }
  .group.end { margin-inline-start: 0; }
  .table { padding: 0 16px 20px; }
  .drop.compact { grid-auto-flow: row; }
  .row { grid-template-columns: 56px 1fr auto 28px; }
  .row .thumb { grid-row: span 2; }
  .row .sizes { grid-column: 2 / 4; }
  .row .badge { grid-column: 3; grid-row: 1; }
  .row .detail, .row .row-actions, .row .error { grid-column: 1 / -1; }
  .row .x { grid-column: 4; grid-row: 1; }
  .row .name { grid-column: 2; grid-row: 1; }
}

.bar-meta .lang { margin-inline-start: 12px; unicode-bidi: isolate; }
:lang(ar) :is(.label, .drop-title, .brand) { letter-spacing: 0; }
/* "1 MB", not "MB 1", in Arabic */
[data-limit] { direction: ltr; unicode-bidi: isolate; }

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--display); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--muted); line-height: 1.6; }
