:root {
  --bg: #0b1220;
  --card: #121a2b;
  --line: #1f2b45;
  --text: #e8edf7;
  --muted: #8b9bb8;
  --accent: #ff5a00;
  --accent-soft: rgba(255, 90, 0, .14);
  --wedge: #48484c;
  --disc: #26262a;
  --ok: #3ddc97;
  --err: #ff6b6b;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(255, 90, 0, .10), transparent 60%),
    var(--bg);
}

.page { max-width: 760px; margin: 0 auto; padding: 28px 16px 56px; }
.embed .hero, .embed .info, .embed .foot, .embed .ad-slot { display: none !important; }
.embed .page { padding-top: 12px; }

/* ---- hero ---- */
.hero { text-align: center; margin-bottom: 22px; }
.hero h1 { margin: 0; font-size: clamp(2rem, 6vw, 2.8rem); letter-spacing: .5px; direction: ltr; }
.hero h1 span { color: var(--accent); }
.lead { margin: 6px 0 2px; font-size: 1.1rem; }
.privacy { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---- drop zone ---- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 34px 18px; text-align: center; cursor: pointer;
  background: var(--card); border: 2px dashed #34456b; border-radius: 20px;
  transition: border-color .15s, background .15s, transform .15s;
}
.drop span { color: var(--muted); font-size: .92rem; }
.drop-icon { font-size: 2.2rem; color: var(--accent); line-height: 1; }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: #151f35; outline: none; }
.drop.over { transform: scale(1.01); }
.compact .drop { padding: 14px; flex-direction: row; justify-content: center; gap: 10px; }
.compact .drop-icon { font-size: 1.3rem; }
.compact .drop span { display: none; }

/* ---- stage ---- */
.stage { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px 14px 20px; }
.files-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chips li {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  background: #1a2540; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .82rem;
}
.chips li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; direction: ltr; }
.chips li small { color: var(--muted); white-space: nowrap; direction: ltr; }

.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .85rem; padding: 4px 6px; white-space: nowrap; }
.link:hover { color: var(--text); text-decoration: underline; }

.modes { display: flex; justify-content: center; gap: 4px; margin: 14px auto 6px; background: #0e1626; border: 1px solid var(--line); border-radius: 999px; padding: 4px; width: fit-content; }
.mode { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 7px 18px; border-radius: 999px; cursor: pointer; }
.mode.active { background: var(--accent); color: #fff; }

/* ---- wheel ---- */
.wheel { width: min(100%, 430px); margin: 0 auto; aspect-ratio: 1; position: relative; direction: ltr; }
.wheel svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wheel .disc { fill: var(--disc); }
.wheel .wedge { cursor: pointer; outline: none; }
.wheel .wedge path { fill: var(--wedge); stroke: var(--wedge); stroke-width: 10; stroke-linejoin: round; transition: fill .12s, stroke .12s; }
.wheel .wedge.suggest path { fill: #9a4513; stroke: #9a4513; }
.wheel .wedge:hover path, .wheel .wedge:focus-visible path { fill: var(--accent); stroke: var(--accent); }
.wheel .wedge text { fill: #fff; font-weight: 700; font-size: 17px; text-anchor: middle; pointer-events: none; font-family: "Segoe UI", system-ui, sans-serif; }
.wheel .wedge text.small { font-size: 12.5px; }
.wheel .pill rect { fill: #4e4e52; }
.wheel .pill text { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; font-family: "Segoe UI", Tahoma, system-ui, sans-serif; }
.wheel.busy .wedge { pointer-events: none; opacity: .55; }
.empty-wheel { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 20px; direction: rtl; }
.hint { text-align: center; color: var(--muted); font-size: .88rem; margin: 6px 0 0; }

/* ---- progress ---- */
.progress { margin-top: 16px; }
.status { font-size: .92rem; color: var(--muted); margin-bottom: 6px; text-align: center; }
.bar { height: 6px; background: #17223a; border-radius: 999px; overflow: hidden; direction: ltr; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.bar.indeterminate i { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* ---- results ---- */
.results { margin-top: 22px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.results-head h2 { margin: 0; font-size: 1.1rem; }
.actions { display: flex; align-items: center; gap: 6px; }
#results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#results li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
#results li.fail { border-color: rgba(255, 107, 107, .5); }
.thumb { width: 48px; height: 48px; border-radius: 10px; flex: none; display: grid; place-items: center; background: #1a2540 center/cover no-repeat; font-size: .72rem; font-weight: 800; color: var(--accent); direction: ltr; }
.meta { flex: 1; min-width: 0; }
.meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; font-weight: 600; }
.meta small { color: var(--muted); direction: ltr; display: inline-block; }
.meta .err { color: var(--err); font-size: .88rem; }
.qr-text { margin-top: 4px; padding: 8px 10px; background: #0e1626; border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; direction: ltr; text-align: left; word-break: break-all; white-space: pre-wrap; max-height: 140px; overflow: auto; }
.btn { display: inline-block; border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; font-size: .9rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.foot { margin-top: 30px; color: var(--muted); font-size: .82rem; text-align: center; }

/* ---- language ---- */
html[data-lang="en"] [data-only="ar"], html[data-lang="ar"] [data-only="en"], html[data-lang="ar"] [data-lang-block="en"], html[data-lang="en"] [data-lang-block="ar"] { display: none !important; }
.hero { position: relative; }
.lang-switch { position: absolute; top: 0; inset-inline-start: 0; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
html[dir="ltr"] .meta b { text-align: left; }
html[dir="ltr"] .info, html[dir="ltr"] .legal { text-align: left; }
.embed .lang-switch { display: none; }

/* ---- ads and content ---- */
.ad-slot { margin: 18px 0; min-height: 100px; text-align: center; overflow: hidden; }
.ad-slot[hidden] { display: none; }
.ad-label { display: block; color: var(--muted); font-size: .7rem; margin-bottom: 4px; }
.info { margin-top: 30px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px 20px; }
.info h2 { margin: 0 0 8px; font-size: 1.25rem; }
.info h3 { margin: 20px 0 6px; font-size: 1.05rem; color: var(--accent); }
.info p, .info li { color: #c9d3e6; font-size: .95rem; }
.info ul, .info ol { padding-inline-start: 22px; margin: 6px 0; }
.info details { border-top: 1px solid var(--line); padding: 8px 0; }
.info summary { cursor: pointer; font-weight: 600; }
.info details p { margin: 6px 0 2px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--text); }
.legal { max-width: 720px; margin: 0 auto; padding: 28px 16px 56px; }
.legal h1 { font-size: 1.6rem; }
.legal h2 { font-size: 1.15rem; margin-top: 24px; }
.legal a { color: var(--accent); }

@media (max-width: 520px) {
  .files-bar { flex-direction: column; align-items: stretch; }
  .link { align-self: flex-start; }
  #results li { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- options dialog ---- */
.modal { position: fixed; inset: 0; background: rgba(5, 9, 18, .72); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { width: min(100%, 380px); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: grid; gap: 14px; }
.modal-box label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.modal-box input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid #34456b; background: #0e1626; color: var(--text); }
.modal-box input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.modal-row { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- tool pages ---- */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 10px; }
.tools-grid a { display: block; padding: 9px 12px; background: #0e1626; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; font-size: .88rem; }
.tools-grid a:hover { border-color: var(--accent); }
.crumb { font-size: .85rem; color: var(--muted); margin: 0 0 6px; }
.crumb a { color: var(--muted); }
.brandlink { display: inline-block; font-size: 1.3rem; font-weight: 800; color: var(--text); text-decoration: none; direction: ltr; letter-spacing: .4px; }
.brandlink span { color: var(--accent); }
.hero h1.h1-tool { font-size: clamp(1.45rem, 4.6vw, 2.1rem); letter-spacing: 0; direction: inherit; margin-top: 4px; }
