/* أدوات Media Station — نفس عائلة موقع المؤسسة: رمادي فاتح، أسود، بنفسجي المؤسسة، Readex Pro */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #ececf0;
  --ink: #1d1d1f;
  --ink-2: #48484d;
  --ink-3: #6e6e73;
  --line: #d9d9de;
  --brand: #561a6c;          /* بنفسجي المؤسسة: الأزرار والروابط */
  --brand-ink: #ffffff;
  --brand-soft: #f1e9f4;
  --magenta: #c8459a;        /* من الشعار: التقدّم والتركيز بس */
  --ok: #1e7f46;
  --ok-soft: #e3f3e9;
  --warn: #8a5a00;
  --warn-soft: #fbf1db;
  --err: #b4232f;
  --err-soft: #fbe7e8;
  --radius: 22px;
  --radius-s: 14px;
  --font: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --ink: #f5f5f7; --ink-2: #c7c7cc; --ink-3: #8e8e93;
    --line: #38383a; --brand: #b98ad0; --brand-ink: #160a1c; --brand-soft: #2a1733; --magenta: #e07abd;
    --ok: #4cc782; --ok-soft: #12291b; --warn: #f0b04a; --warn-soft: #2e230d; --err: #ff6b6b; --err-soft: #331517;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --ink: #f5f5f7; --ink-2: #c7c7cc; --ink-3: #8e8e93;
  --line: #38383a; --brand: #b98ad0; --brand-ink: #160a1c; --brand-soft: #2a1733; --magenta: #e07abd;
  --ok: #4cc782; --ok-soft: #12291b; --warn: #f0b04a; --warn-soft: #2e230d; --err: #ff6b6b; --err-soft: #331517;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.65; font-weight: 400; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video, canvas { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }
@media (max-width: 640px) { .wrap { width: calc(100% - 32px); } }

/* ---------- header: شريط زجاجي رفيع مثل أبل ---------- */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.top .wrap { display: flex; align-items: center; gap: 20px; min-height: 52px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-size: 15px; }
.brand a { color: inherit; display: flex; align-items: center; }
.brand a:hover { text-decoration: none; opacity: .8; }
.brand img { height: 22px; width: auto; }
.brand .sep { width: 1px; height: 18px; background: var(--line); }
.nav { display: flex; gap: 22px; margin-inline-start: auto; }
.nav a { color: var(--ink-2); font-size: 14px; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.lang { border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: 14px; padding: 4px 0; }
.lang:hover { color: var(--ink); }
@media (max-width: 640px) {
  .nav { gap: 14px; }
  .nav a:not([aria-current]) { display: none; }
  .nav a.keep { display: inline; }
}

/* ---------- شريط الأدوات: أيقونات وتحتها الاسم (مثل قائمة منتجات أبل) ---------- */
.tooltabs { background: var(--surface); border-bottom: 1px solid var(--line); }
.tooltabs .wrap { display: flex; justify-content: center; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 10px 0 8px; }
.tooltabs .wrap::-webkit-scrollbar { display: none; }
.tooltabs a { flex: 0 0 auto; display: grid; justify-items: center; gap: 4px; min-width: 76px; padding: 6px 8px;
  color: var(--ink-2); font-size: 12px; line-height: 1.3; text-align: center; border-radius: 12px; }
.tooltabs a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.tooltabs svg { width: 26px; height: 26px; stroke-width: 1.6; }
.tooltabs a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.tooltabs a[aria-current="page"] svg { stroke-width: 2; }
@media (max-width: 900px) { .tooltabs .wrap { justify-content: flex-start; } }

/* ---------- hero ---------- */
.hero { padding: clamp(48px, 8vw, 96px) 0 clamp(24px, 4vw, 40px); text-align: center; }
.hero h1 { margin-inline: auto; }
.hero .lead { margin-inline: auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); font-weight: 400; }
.eyebrow::before { content: ""; width: 14px; height: 14px; flex: none;
  background: currentColor; -webkit-mask: var(--lock) center / contain no-repeat; mask: var(--lock) center / contain no-repeat; }
:root { --lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E"); }
h1 { font-size: clamp(36px, 6.2vw, 72px); line-height: 1.12; font-weight: 700; margin: 14px 0 16px; max-width: 16ch; }
h1 em { font-style: normal; color: inherit; font-weight: 200; display: block; }
/* صفحات الأدوات: عنوان أصغر عشان الأداة تبان من أول الشاشة */
.tooltabs ~ main .hero { padding: clamp(32px, 5vw, 56px) 0 clamp(16px, 3vw, 28px); }
.tooltabs ~ main h1 { font-size: clamp(30px, 4.4vw, 52px); max-width: 20ch; }
.tooltabs ~ main .lead { font-size: clamp(16px, 1.8vw, 19px); }
.lead { font-size: clamp(18px, 2.2vw, 22px); line-height: 1.55; color: var(--ink-2); max-width: 640px; margin: 0; font-weight: 300; }
h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.2; margin: 0 0 14px; font-weight: 700; }
h3 { font-size: 20px; margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }

/* ---------- شبكة الأدوات في الرئيسية ---------- */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 24px 0 64px; }
.tool { display: flex; flex-direction: column; gap: 6px; color: var(--ink); background: var(--surface); border-radius: var(--radius);
  padding: 30px 28px; min-height: 210px; transition: transform .25s ease; }
.tool:hover { text-decoration: none; transform: scale(1.012); }
.tool .ico { width: 40px; height: 40px; color: var(--brand); margin-bottom: 12px; }
.tool .ico svg { width: 36px; height: 36px; stroke-width: 1.6; }
.tool h2 { font-size: 24px; margin: 0; }
.tool p { margin: 0; color: var(--ink-3); font-size: 16px; }
.tool .go { margin-top: auto; padding-top: 14px; color: var(--brand); font-size: 15px; }
/* أداة الإصلاح: البطاقة الرئيسية، عرضين وسوداء */
.tool.feature-tool { grid-column: 1 / -1; background: #000; color: #f5f5f7; min-height: 260px; padding: 44px; }
.tool.feature-tool p { color: #a1a1a6; font-size: 18px; max-width: 46ch; }
.tool.feature-tool h2 { font-size: clamp(28px, 3.6vw, 44px); }
.tool.feature-tool .ico, .tool.feature-tool .go { color: #d7a6ea; }
.tool.feature-tool { position: relative; overflow: hidden; }
.fx { position: absolute; inset-inline-end: 44px; top: 50%; transform: translateY(-50%); display: grid; justify-items: center; gap: 10px;
  font-family: var(--mono); font-size: clamp(18px, 2.4vw, 28px); color: #6e6e73; }
.fx span { direction: ltr; unicode-bidi: isolate; }
.fx .bad { text-decoration: line-through; text-decoration-color: #b4232f; text-decoration-thickness: 2px; }
.fx .good { color: #f5f5f7; }
.fx svg { transform: rotate(-90deg); color: #d7a6ea; }
@media (max-width: 760px) { .fx { display: none; } }
@media (max-width: 640px) { .tool.feature-tool { padding: 30px 26px; } .brand a[data-i18n], .brand .sep { display: none; } }
/* الوضع الليلي: البطاقة الرئيسية بنفسجي غامق بدل الأسود عشان تبان على الخلفية السوداء */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tool.feature-tool { background: #24112d; } :root:not([data-theme="light"]) .support { background: #24112d; } }
:root[data-theme="dark"] .tool.feature-tool, :root[data-theme="dark"] .support { background: #24112d; }
@media (prefers-reduced-motion: reduce) { .tool { transition: none; } .tool:hover { transform: none; } }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; margin: 24px 0 56px; }
.feature { padding: 0; }
.feature h3 { font-size: 18px; }
.feature p { margin: 0; color: var(--ink-3); font-size: 16px; }

/* ---------- لوحة الأداة ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 860px; margin-inline: auto; gap: 28px; align-items: start; padding-bottom: 56px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: clamp(20px, 3.4vw, 36px); }
.panel + .panel { margin-top: 18px; }

.drop { display: block; border: 1.5px dashed var(--line); border-radius: var(--radius-s); padding: 44px 20px; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s; background: var(--bg); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { display: block; font-size: 19px; font-weight: 600; }
.drop input { display: none; }
.drop .icon { margin: 0 auto 12px; color: var(--brand); }

.files { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-s);
  background: var(--bg); min-width: 0; }
.file .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.file .meta { color: var(--ink-3); font-size: 13px; margin-inline-start: auto; white-space: nowrap; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tag.broken { background: var(--err-soft); color: var(--err); }
.tag.ref { background: var(--ok-soft); color: var(--ok); }
.tag.other { background: var(--surface-2); color: var(--ink-2); }
.file button { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 2px 6px; border-radius: 8px; }
.file button:hover { background: var(--surface-2); color: var(--ink); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
/* أزرار كبسولة مثل أبل */
.btn { border: 0; border-radius: 980px; padding: 12px 24px; font-weight: 500; cursor: pointer; background: var(--ink);
  color: var(--bg); font-size: 16px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: filter .15s; }
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn.rec { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 18px 0 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--magenta); border-radius: inherit; transition: width .2s; }
.status { font-size: 15px; color: var(--ink-3); min-height: 1.6em; }

.note { border-radius: var(--radius-s); padding: 14px 18px; font-size: 15px; margin-top: 16px; }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.err { background: var(--err-soft); color: var(--err); }
.note a { color: inherit; text-decoration: underline; }
.hidden { display: none !important; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 18px; }
.stat { background: var(--bg); border-radius: var(--radius-s); padding: 14px 16px; }
.stat b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.stat span { font-size: 13px; color: var(--ink-3); }
.preview { margin-top: 18px; border-radius: var(--radius-s); overflow: hidden; background: #000; aspect-ratio: 16/9; }
.preview canvas { width: 100%; height: 100%; object-fit: contain; }

/* ---------- خيارات ---------- */
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; margin-top: 12px; }
.fmt { position: relative; }
.fmt input { position: absolute; opacity: 0; }
.fmt label { display: block; border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 11px 13px; cursor: pointer;
  background: var(--surface); transition: border-color .15s; }
.fmt label:hover { border-color: var(--ink-3); }
.fmt label b { display: block; font-size: 15px; font-weight: 600; }
.fmt label span { font-size: 12px; color: var(--ink-3); line-height: 1.4; display: block; }
.fmt input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.fmt input:focus-visible + label { outline: 3px solid var(--magenta); outline-offset: 2px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-top: 20px; }
.opts label { font-size: 14px; color: var(--ink-3); display: grid; gap: 6px; }
.opts select, .opts input[type="text"] { border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px;
  background: var(--surface); width: 100%; color: var(--ink); }
.check { display: flex !important; align-items: center; gap: 8px; grid-template-columns: none !important; color: var(--ink-2) !important; }
.check input { accent-color: var(--brand); width: 18px; height: 18px; }
.section-title { font-weight: 600; margin-top: 26px; font-size: 17px; }

/* ---------- محتوى ---------- */
.prose { max-width: 740px; }
.prose p, .prose li { color: var(--ink-2); }
.prose h2 { margin-top: 44px; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 44px; }
.steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 1px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: 14px; }
details { border-bottom: 1px solid var(--line); padding: 16px 0; }
summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--ink-3); font-weight: 300; font-size: 22px; line-height: 1; }
details[open] summary::after { content: "−"; }
details p { margin: 10px 0 0; color: var(--ink-2); }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }

/* ---------- خدمة Media Station (بدل أزرار الدعم) ---------- */
.support { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
  background: #000; color: #f5f5f7; border-radius: var(--radius); padding: 26px 28px; margin: 20px 0; }
.support span { font-size: 17px; max-width: 52ch; }
.support span b { display: block; font-size: 20px; font-weight: 600; margin-bottom: 2px; }
.support .row { margin: 0; }
.support .btn { background: #f5f5f7; color: #000; }

footer { padding: 36px 0 48px; color: var(--ink-3); font-size: 13px; }
footer .wrap { display: flex; gap: 12px 24px; flex-wrap: wrap; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 22px; }
footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
footer a { color: var(--ink-2); }
footer .support { border-top: 0; }

/* ---------- عناصر الأدوات ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 18px; }
.thumbs figure { margin: 0; background: #000; border-radius: 12px; overflow: hidden; position: relative; }
.thumbs img { width: 100%; height: auto; display: block; }
.thumbs figcaption { position: absolute; inset-inline-start: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px;
  padding: 1px 6px; border-radius: 6px; direction: ltr; }
.cliplist { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.cliplist .file .ord { display: flex; gap: 4px; }
.cliplist .file .ord button { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 2px 9px; }
table.kv { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
table.kv th { text-align: start; color: var(--ink-3); font-weight: 400; padding: 8px 0; width: 40%; vertical-align: top; }
table.kv td { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
table.kv tr:last-child td { border-bottom: 0; }
.subs { max-height: 440px; overflow: auto; margin-top: 18px; display: grid; gap: 6px; }
.subs .cue { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 12px; background: var(--bg); border-radius: 12px; }
.subs .cue time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); direction: ltr; }
.subs .cue [contenteditable] { outline: none; }
input[type="range"] { width: 100%; accent-color: var(--brand); }

/* نسخة الجهاز بدون إعلانات: عمود واحد */

/* حاسبة التصوير */
.calc + .calc { margin-top: 36px; padding-top: 30px; border-top: 1px solid var(--line); }
.calc .stats { margin-top: 16px; }
@media (max-width: 640px) { .calc label[style*="span 2"] { grid-column: auto !important; } }

/* صانع الثمنيل: قوالب وألوان */
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.tpl { border: 2px solid var(--line); border-radius: var(--radius-s); overflow: hidden; cursor: pointer; background: #000; padding: 0; text-align: center; color: var(--ink); }
.tpl canvas { display: block; width: 100%; height: auto; }
.tpl span { display: block; font-size: 13px; padding: 6px; background: var(--surface); }
.tpl[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--brand); }
details.more summary { cursor: pointer; font-weight: 600; padding: 8px 0; }

/* نصائح لأفضل نتيجة */
.tips-box { margin-top: 20px; background: var(--surface); border-radius: var(--radius); padding: 22px 26px; border: 1px solid var(--line); }
.tips-box h2 { font-size: 19px; margin: 0 0 10px; }
.tips-box ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; line-height: 1.7; }
.tips-box li::marker { color: var(--magenta); }
.tips-box p { margin: 12px 0 0; }
@media (max-width: 600px) { .tips-box { padding: 18px; } }
@media (max-width: 600px) {
  .tpls { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tpl span { font-size: 11px; padding: 4px; }
  .swatch { width: 38px; height: 38px; }
}
@media (max-width: 600px) {
  .thumbs { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .thumbs figcaption { font-size: 10px; }
}

/* تحسين الجودة: مقارنة قبل وبعد */
.compare { position: relative; margin: 18px auto 0; max-width: 520px; border-radius: var(--radius-s); overflow: hidden; background: #000; aspect-ratio: 1; }
.compare canvas { display: block; width: 100%; height: 100%; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; direction: ltr; }
.compare .lbl { position: absolute; top: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 99px; pointer-events: none; }
.compare .lbl.before { left: 10px; } .compare .lbl.after { right: 10px; }

.mobile-note { margin: 16px auto 0; max-width: 560px; font-size: 14px; }
.stats-line { margin-top: 14px; color: var(--ink-2); font-size: 15px; }
.stats-line b { color: var(--ink); font-weight: 700; }

/* خلفية مربعات للصور الشفافة */
.preview.checker { background: repeating-conic-gradient(#d9d9de 0 25%, #fff 0 50%) 0 0 / 22px 22px; }
.preview.checker canvas { object-fit: contain; }
