:root{
  --ink:#15192b;--paper:#f2f4f8;--card:#ffffff;--line:#dfe3ec;--muted:#5d6478;
  --coral:#e5322d;--saffron:#f59e0b;--mint:#10b39a;--plum:#7a4cff;
  --r:18px;
  font-family:system-ui,-apple-system,"Segoe UI",Tahoma,"Noto Sans Arabic","Geeza Pro",Roboto,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);line-height:1.6}
a{color:inherit}
.wrap{max-width:1040px;margin:0 auto;padding:0 18px 40px}
.top{display:flex;align-items:center;justify-content:space-between;gap:12px;max-width:1040px;margin:0 auto;padding:16px 18px}
.logo{display:flex;align-items:center;gap:9px;font-weight:800;font-size:1.45rem;text-decoration:none;letter-spacing:-.02em}
.dot{width:26px;height:26px;border-radius:50%;background:conic-gradient(var(--coral) 0 25%,var(--saffron) 0 50%,var(--mint) 0 75%,var(--plum) 0);box-shadow:inset 0 0 0 7px var(--paper)}
.langs{display:flex;gap:4px;flex-wrap:wrap}
.langs a{font-size:.85rem;text-decoration:none;padding:5px 10px;border-radius:99px;color:var(--muted)}
.langs a[aria-current]{background:var(--ink);color:var(--paper)}
#lang-suggest{max-width:1040px;margin:0 auto 8px;padding:10px 18px;background:#fff3d6;border-radius:12px;font-size:.92rem;display:flex;gap:10px;align-items:center;justify-content:space-between}
#lang-suggest[hidden]{display:none}
#lang-suggest button{border:0;background:none;font-size:1.1rem;cursor:pointer}

.hero{text-align:center;padding:34px 0 18px;position:relative}
.hero h1{font-size:clamp(1.7rem,4.6vw,2.9rem);line-height:1.15;margin:18px auto 10px;max-width:760px;letter-spacing:-.02em}
.hero p{color:var(--muted);max-width:620px;margin:0 auto;font-size:1.05rem}
.wheel{display:inline-block;width:64px;height:64px;border-radius:50%;
  background:conic-gradient(var(--coral) 0 16.6%,var(--saffron) 0 33.3%,var(--mint) 0 50%,var(--plum) 0 66.6%,var(--coral) 0 83.3%,var(--saffron) 0);
  -webkit-mask:radial-gradient(circle,transparent 38%,#000 39%);mask:radial-gradient(circle,transparent 38%,#000 39%)}
.wheel.big{width:92px;height:92px;animation:spin 18s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.wheel.big{animation:none}}

h2{font-size:1.25rem;margin:34px 0 14px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
.card{display:flex;flex-direction:column;gap:4px;background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:16px;text-decoration:none;transition:transform .15s,box-shadow .15s}
.card:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(20,17,15,.08)}
.card .ic{font-size:1.6rem}
.card small{color:var(--muted);line-height:1.45}

.crumbs{font-size:.9rem;color:var(--muted);margin-top:4px}
.wrap>h1{font-size:clamp(1.6rem,4vw,2.3rem);margin:10px 0 4px;letter-spacing:-.02em}
.lead{color:var(--muted);margin:0 0 18px}

.tool{background:var(--card);border:1px solid var(--line);border-radius:24px;padding:16px}
.drop{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;border:2px dashed #d9cfbf;border-radius:18px;padding:38px 16px;cursor:pointer;transition:background .15s,border-color .15s}
.drop:hover,.drop.over{background:#fff8ec;border-color:var(--coral)}
.drop u{color:var(--coral);font-weight:700;text-decoration:none}
.drop small{color:var(--muted)}
.tool.has-files .drop{padding:14px;flex-direction:row;justify-content:center}
.tool.has-files .drop .wheel{width:28px;height:28px}
.tool.has-files .drop small{display:none}

.stage{margin-top:14px}
.files{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.files li{display:flex;align-items:center;gap:10px;background:var(--paper);border-radius:12px;padding:8px 10px}
.files img,.files canvas{width:46px;height:46px;object-fit:cover;border-radius:8px;background:#eee;flex:none}
.files .meta{flex:1;min-width:0}
.files .meta b{display:block;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.files .meta small{color:var(--muted)}
.files .row-btns{display:flex;gap:4px}
.files .row-btns button{border:1px solid var(--line);background:#fff;border-radius:8px;width:32px;height:32px;cursor:pointer}

.opts{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;margin-top:14px}
.opts label{display:flex;flex-direction:column;gap:4px;font-size:.85rem;color:var(--muted);min-width:140px}
.opts label.wide{flex:1;min-width:200px}
.opts select,.opts input[type=text]{font:inherit;color:var(--ink);padding:9px 10px;border:1px solid var(--line);border-radius:10px;background:#fff}
.opts input[type=range]{accent-color:var(--coral);width:170px}
.opts output{font-weight:700;color:var(--ink)}
.actions{display:flex;gap:8px;width:100%;margin-top:4px}
button.go{font:inherit;font-weight:700;background:var(--ink);color:var(--paper);border:0;border-radius:12px;padding:12px 22px;cursor:pointer;flex:1;max-width:320px}
button.go:disabled{opacity:.6;cursor:wait}
button.ghost{font:inherit;background:none;border:1px solid var(--line);border-radius:12px;padding:12px 16px;cursor:pointer}
.chips{display:flex;flex-wrap:wrap;gap:6px;width:100%}
.chips button{font:inherit;font-size:.9rem;border:1px solid var(--line);background:#fff;border-radius:99px;padding:6px 14px;cursor:pointer}
.chips button[aria-pressed=true]{background:var(--ink);color:var(--paper);border-color:var(--ink)}

.cropbox{position:relative;display:inline-block;overflow:hidden;max-width:100%;touch-action:none;user-select:none}
.cropbox img{display:block;max-width:100%;max-height:70vh}
.cropbox .sel{position:absolute;border:2px solid #fff;box-shadow:0 0 0 9999px rgba(20,17,15,.55);cursor:move}
.cropbox .handle{position:absolute;width:22px;height:22px;right:-11px;bottom:-11px;background:var(--coral);border:3px solid #fff;border-radius:50%;cursor:nwse-resize}
.stage.crop{text-align:center}

.results{margin-top:14px;display:grid;gap:8px}
.results .res{display:flex;align-items:center;gap:10px;background:#eefaf6;border-radius:12px;padding:8px 10px}
.results .res.err{background:#fdecea}
.results .res .meta{flex:1;min-width:0}
.results .res b{display:block;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.results .res small{color:var(--muted)}
.results .res .gain{color:var(--mint);font-weight:700}
.results a.dl,.results button.dl{font:inherit;font-weight:700;font-size:.9rem;background:var(--mint);color:#fff;text-decoration:none;border:0;border-radius:10px;padding:8px 14px;cursor:pointer;white-space:nowrap}
.results .all{display:flex;justify-content:center;margin-top:4px}
.results .all .dl{background:var(--coral);padding:12px 22px}
.status{text-align:center;color:var(--muted);font-weight:600}
.note{text-align:center;color:var(--muted);font-size:.85rem;margin:12px 0 0}

.info{margin-top:10px}
.info ol{padding-inline-start:22px}
details{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 14px;margin-bottom:8px}
summary{cursor:pointer;font-weight:600}
.prose{max-width:720px}

.ad-slot{display:flex;justify-content:center;margin:18px auto;min-height:0}
.ad-slot:empty{margin:0}
.native-ad{margin:10px 0}
.foot{text-align:center;color:var(--muted);font-size:.88rem;padding:24px 18px 40px;border-top:1px solid var(--line)}
.foot a{color:var(--muted)}

/* hints + PDF editor */
.hint{font-size:.82rem;color:var(--muted);margin:0;width:100%}
.edbar{display:flex;flex-wrap:wrap;gap:6px;align-items:flex-end;width:100%}
.edbar>button{font:inherit;font-size:.88rem;border:1px solid var(--line);background:#fff;border-radius:10px;padding:8px 12px;cursor:pointer}
.edbar>button[aria-pressed=true]{background:var(--ink);color:var(--paper);border-color:var(--ink)}
.edbar label.mini{min-width:0}
.edbar input[type=color]{width:44px;height:38px;padding:2px;border:1px solid var(--line);border-radius:10px;background:#fff}
@media (max-width:560px){.edbar>button span{display:none}}
.ed-pages{display:grid;gap:18px;justify-items:center;background:#efe9df;border-radius:16px;padding:14px;max-height:78vh;overflow:auto}
.ed-wrap{display:flex;flex-direction:column;align-items:center;gap:6px;max-width:100%}
.ed-ptools{display:flex;gap:6px;align-items:center;font-size:.85rem;color:var(--muted)}
.ed-ptools button{font:inherit;border:1px solid var(--line);background:#fff;border-radius:8px;min-width:34px;height:32px;cursor:pointer}
.ed-page{position:relative;box-shadow:0 4px 18px rgba(0,0,0,.12);background:#fff;transition:transform .2s;touch-action:none}
.ed-page canvas{display:block}
.ed-page .ink{position:absolute;inset:0}
.ed-page .layer{position:absolute;inset:0}
.ed-page.gone{opacity:.25;pointer-events:none}
.ann{position:absolute;outline:1px dashed rgba(255,93,46,.7)}
.ann .x{position:absolute;top:-11px;inset-inline-end:-11px;width:22px;height:22px;border-radius:50%;background:var(--coral);color:#fff;font-size:13px;line-height:22px;text-align:center;cursor:pointer;user-select:none}
.ann .h{position:absolute;right:-8px;bottom:-8px;width:16px;height:16px;border-radius:50%;background:var(--coral);border:2px solid #fff;cursor:nwse-resize}
.ann.txt{min-width:30px;padding:2px 4px;line-height:1.3;white-space:pre;font-family:system-ui,-apple-system,"Segoe UI",Tahoma,"Noto Sans Arabic",sans-serif;background:rgba(255,255,255,.01)}
.ann.txt:focus{outline:2px solid var(--coral)}
.ann.white{background:#fff}
.ann.img img{width:100%;height:100%;display:block;pointer-events:none}
.mode-move .ann{cursor:move}
.mode-draw .ink{cursor:crosshair}
.mode-text .layer,.mode-white .layer,.mode-image .layer{cursor:crosshair}
.mode-draw .layer{pointer-events:none}
.tool[data-kind=pdfedit]{display:flex;flex-direction:column}
.tool[data-kind=pdfedit] .drop{order:0}
.tool[data-kind=pdfedit] .opts{order:1;position:sticky;top:0;z-index:5;background:#fff;padding:8px 0;margin-top:10px}
.tool[data-kind=pdfedit] .results{order:2}
.tool[data-kind=pdfedit] .stage{order:3}
.tool[data-kind=pdfedit] .note{order:4}
.card .ct{display:flex;flex-direction:column;gap:4px}
@media (max-width:640px){
  .hero{padding:14px 0 4px}
  .hero h1{font-size:1.45rem;margin:10px auto 6px}
  .hero p{font-size:.92rem}
  .wheel.big{width:54px;height:54px}
  h2{font-size:1.05rem;margin:22px 0 10px}
  .grid{grid-template-columns:1fr 1fr;gap:8px}
  .card{flex-direction:row;align-items:center;gap:8px;padding:12px 10px;border-radius:14px}
  .card .ic{font-size:1.35rem;flex:none}
  .card b{font-size:.88rem;line-height:1.3}
  .card small{display:none}
}

/* ===== File-sticker identity ===== */
.file{position:relative;flex:none;width:58px;height:70px;border-radius:8px 18px 8px 8px;background:var(--c);color:#fff;
  display:flex;flex-direction:column;align-items:center;justify-content:flex-end;padding:0 0 9px;
  box-shadow:0 6px 0 -2px color-mix(in srgb,var(--c) 55%,#000),0 10px 18px -8px color-mix(in srgb,var(--c) 70%,transparent);
  clip-path:polygon(0 0,calc(100% - 18px) 0,100% 18px,100% 100%,0 100%);transition:transform .18s}
.file::before{content:"";position:absolute;top:0;right:0;width:18px;height:18px;background:color-mix(in srgb,var(--c) 60%,#fff);border-bottom-left-radius:6px}
.file i{font-style:normal;font-weight:900;font-size:.95rem;letter-spacing:.02em;line-height:1}
.file em{font-style:normal;font-weight:700;font-size:.66rem;margin-top:4px;padding:2px 6px;border-radius:99px;background:rgba(255,255,255,.22);direction:ltr}
.file.big{width:74px;height:90px;padding-bottom:12px}
.file.big i{font-size:1.2rem}.file.big em{font-size:.78rem}

.card{flex-direction:row;align-items:center;gap:16px;padding:16px 18px;border:2px solid var(--line);border-radius:20px;background:#fff;transition:border-color .18s,transform .18s}
.card:hover,.card:focus-visible{border-color:var(--c);transform:translateY(-2px);box-shadow:0 14px 30px -18px var(--c);outline:none}
.card:hover .file,.card:focus-visible .file{transform:rotate(-6deg) translateY(-2px)}
[dir=rtl] .card:hover .file{transform:rotate(6deg) translateY(-2px)}
.card b{font-size:1.02rem}
.card small{font-size:.86rem}

.hero h1{letter-spacing:-.03em}
.dot{background:conic-gradient(var(--coral) 0 25%,var(--saffron) 0 50%,var(--mint) 0 75%,var(--plum) 0)}
.wheel{background:conic-gradient(#e5322d 0 16.6%,#f59e0b 0 33.3%,#10b39a 0 50%,#2f6bff 0 66.6%,#7a4cff 0 83.3%,#ec4899 0)}

.tool-head{display:flex;align-items:center;gap:16px;margin:12px 0 6px}
.tool-head h1{margin:0;font-size:clamp(1.6rem,4vw,2.3rem);letter-spacing:-.02em}
button.go{background:var(--c,var(--ink));box-shadow:0 5px 0 -1px color-mix(in srgb,var(--c,#15192b) 60%,#000);transition:transform .1s,box-shadow .1s}
button.go:active{transform:translateY(3px);box-shadow:0 2px 0 -1px color-mix(in srgb,var(--c,#15192b) 60%,#000)}
.drop{border-color:color-mix(in srgb,var(--c,#2f6bff) 40%,#cfd5e2)}
.drop:hover,.drop.over{background:color-mix(in srgb,var(--c,#2f6bff) 6%,#fff);border-color:var(--c,#2f6bff)}
.drop u{color:var(--c,#2f6bff)}
.results a.dl,.results button.dl{background:var(--mint)}
.results .all .dl{background:var(--c,var(--coral))}
.opts input[type=range]{accent-color:var(--c,#2f6bff)}
.chips button[aria-pressed=true],.edbar>button[aria-pressed=true]{background:var(--c,var(--ink));border-color:var(--c,var(--ink))}
#lang-suggest{background:#e8eefc}

@media (max-width:640px){
  .grid{grid-template-columns:1fr 1fr;gap:10px}
  .card{flex-direction:column;align-items:flex-start;gap:10px;padding:14px 12px;border-radius:16px}
  .card .file{width:46px;height:56px;padding-bottom:7px;border-radius:7px 14px 7px 7px;clip-path:polygon(0 0,calc(100% - 14px) 0,100% 14px,100% 100%,0 100%)}
  .card .file::before{width:14px;height:14px}
  .card .file i{font-size:.8rem}.card .file em{font-size:.58rem;padding:1px 5px}
  .card b{font-size:.9rem}
  .tool-head .file.big{width:58px;height:70px}
}

.fan{display:flex;justify-content:center;align-items:flex-end;height:118px;margin:6px 0 26px}
.fan .file{margin:0 -6px;transform:rotate(calc(var(--i) * 9deg)) translateY(calc(var(--i) * var(--i) * 5px));animation:deal .7s cubic-bezier(.2,.8,.2,1.2) both;animation-delay:calc((var(--i) + 2) * 70ms)}
.fan .file:nth-child(3){z-index:2;width:86px;height:104px}
@keyframes deal{from{opacity:0;transform:translateY(40px) rotate(0)}}
@media (prefers-reduced-motion:reduce){.fan .file{animation:none}}
@media (max-width:640px){.fan{height:92px;margin-bottom:26px}.fan .file{width:54px;height:66px;padding-bottom:8px}.fan .file i{font-size:.85rem}.fan .file em{font-size:.6rem}.fan .file:nth-child(3){width:64px;height:78px}}

.results .res .gain{white-space:pre-line}
