@font-face { font-family: "Cairo"; src: url("../fonts/Cairo.ttf") format("truetype"); font-weight: 200 1000; font-style: normal; font-display: swap; }
/* ---------- Tokens ---------- */
:root {
  --bg: #0B1425;
  --surface: #17243A;
  --surface-2: #1E2F4A;
  --border: rgba(255, 255, 255, .08);
  --text: #E8EEF8;
  --muted: #8FA3BF;
  --accent: #FF6B1A;
  --accent-2: #FF9A4D;
  --accent-ink: #06121f;
  --danger: #ff7b7b;
  --ok: #4ade80;
  --warn: #fbbf24;
  --glow: 0 0 0 1px rgba(255, 107, 26, .35), 0 8px 30px rgba(255, 107, 26, .22);
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --hero-glow: radial-gradient(60% 55% at 50% 0%, rgba(255, 107, 26, .20), transparent 70%);
  --radius: 16px;
  --font: "Cairo", "Segoe UI", system-ui, -apple-system, Tahoma, Arial, sans-serif;
}
:root[data-theme="light"] {
  --bg: #F2F6FC;
  --surface: #FFFFFF;
  --surface-2: #EAF1FA;
  --border: rgba(11, 20, 37, .10);
  --text: #0B1425;
  --muted: #5A6B83;
  --accent: #E85D04;
  --danger: #d33a3a;
  --ok: #17924a;
  --warn: #a96b00;
  --glow: 0 0 0 1px rgba(240, 90, 0, .4), 0 8px 24px rgba(240, 90, 0, .22);
  --shadow: 0 8px 24px rgba(20, 40, 80, .10);
  --hero-glow: radial-gradient(60% 55% at 50% 0%, rgba(240, 90, 0, .18), transparent 70%);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; transition: background .25s, color .25s; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
svg { width: 1.25em; height: 1.25em; flex: none; }
[hidden] { display: none !important; }
.container { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; z-index: 100; font-weight: 700; }
.skip-link:focus { top: 10px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 14px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.brand-logo { width: 38px; height: 38px; flex: none; }
.bm-sq { fill: var(--text); fill-opacity: .55; }
.wordmark { font-weight: 500; letter-spacing: .03em; unicode-bidi: isolate; }
.wordmark b { font-weight: 800; }
.nav { display: flex; gap: 4px; margin-inline-start: 12px; flex: 1; }
.nav a { white-space: nowrap; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .95rem; transition: color .2s, background .2s; }
.nav a:hover { color: var(--text); background: var(--surface); }
.header-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.icon-btn { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .2s, transform .15s, box-shadow .2s; }
.icon-btn:hover { border-color: var(--accent); box-shadow: var(--glow); }
.icon-btn:active { transform: scale(.95); }
.lang-btn { font-weight: 700; font-size: .85rem; }
.menu-btn { display: none; }
:root[data-theme="dark"] .i-moon, :root[data-theme="light"] .i-sun { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 1rem; cursor: pointer; white-space: nowrap; transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 4px 18px rgba(255, 107, 26, .28); }
.btn-primary:hover:not(:disabled) { box-shadow: var(--glow); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn-lg { height: 52px; padding: 0 30px; }
.btn-sm { height: 38px; padding: 0 16px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); font-weight: 600; }
.link-btn:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero { background: var(--hero-glow); padding: 64px 0 28px; }
.hero-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); font-weight: 800; line-height: 1.2; background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 62%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); max-width: 620px; font-size: 1.05rem; }
.url-form { display: flex; gap: 10px; width: min(760px, 100%); padding: 10px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); margin-top: 8px; transition: box-shadow .2s, border-color .2s; }
.url-form:focus-within { border-color: var(--accent); box-shadow: var(--glow); }
.url-form input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem; text-align: start; }
.url-form input:focus { outline: none; }
.url-form input::placeholder { color: var(--muted); opacity: .8; }
.field-error { color: var(--danger); font-weight: 600; margin-top: -6px; }
.platforms { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.platforms li { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .9rem; font-weight: 600; transition: transform .2s, border-color .2s; }
.platforms li:hover { transform: translateY(-2px); border-color: var(--accent); }
.pf-yt { color: #ff4e45; } .pf-tt { color: #25d9d3; } .pf-ig { color: #e8467f; } .pf-fb { color: #4c8bf5; } .pf-x { color: var(--text); }
.hero-notice { color: var(--muted); font-size: .85rem; max-width: 640px; }
.banner { padding: 12px 18px; border-radius: 12px; font-weight: 600; width: min(760px, 100%); }
.banner-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }

/* ---------- Cards / sections ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.section { padding: 56px 0 0; }
.section-tight { padding-top: 14px; }
.section-head { margin-bottom: 24px; display: flex; flex-direction: column; gap: 6px; }
.section-head.center { text-align: center; align-items: center; }
.row-between { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; text-align: center; color: var(--muted); box-shadow: none; border-style: dashed; }
.empty svg { width: 52px; height: 52px; opacity: .7; }

/* ---------- Preview ---------- */
.preview { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 24px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--surface-2); align-self: start; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.thumb-fallback svg { width: 56px; height: 56px; }
.dur-badge { position: absolute; inset-inline-end: 8px; bottom: 8px; background: rgba(0, 0, 0, .75); color: #fff; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; direction: ltr; }
.pv-title { font-size: 1.2rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip { padding: 3px 12px; border-radius: 999px; background: var(--surface-2); font-size: .82rem; font-weight: 600; color: var(--muted); }
.chip-accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.opt-group { margin-top: 16px; }
.opt-label { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 8px 22px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-select button { border: 1px solid var(--border); background: var(--surface-2); padding: 7px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: border-color .2s, background .2s, transform .15s; }
.chips-select button:hover { border-color: var(--accent); }
.chips-select button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: var(--accent); }
.hint { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.progress-box { margin-top: 18px; }
.progress-head { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.progress-track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
#progressFill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.progress-track.indeterminate #progressFill { width: 35% !important; animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { from { margin-inline-start: 0; } to { margin-inline-start: 65%; } }
.dl-msg { margin-top: 14px; font-weight: 600; }
.dl-msg.ok { color: var(--ok); } .dl-msg.err { color: var(--danger); } .dl-msg.info { color: var(--muted); }

.error-card { display: flex; gap: 14px; align-items: flex-start; border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.error-card svg { width: 28px; height: 28px; color: var(--danger); margin-top: 2px; }
.error-title { font-weight: 700; }
.error-detail { color: var(--muted); font-size: .88rem; margin-top: 4px; word-break: break-word; }

/* skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }
:root[dir="rtl"] .skeleton::after { animation-direction: reverse; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 16px; margin-bottom: 12px; } .mt { margin-top: 26px; }
.w80 { width: 80%; } .w65 { width: 65%; } .w50 { width: 50%; } .w40 { width: 40%; }

/* ---------- History ---------- */
.history-list { display: grid; gap: 10px; }
.h-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 14px 18px; transition: border-color .2s, transform .15s; }
.h-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.h-main { min-width: 0; }
.h-title { font-weight: 700; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.h-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.h-meta .chip { padding: 2px 10px; font-size: .78rem; }
.h-meta .when { color: var(--muted); font-size: .78rem; margin-inline-start: 4px; }
.h-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.failed { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.badge.cancelled, .badge.interrupted { background: var(--surface-2); color: var(--muted); }
.badge.downloading { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.mini-btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 9px; padding: 5px 12px; font-size: .82rem; font-weight: 600; cursor: pointer; }
.mini-btn:hover { border-color: var(--accent); }

/* ---------- Features / steps / FAQ ---------- */
.feature h3, .step h3 { margin: 12px 0 6px; font-size: 1.05rem; }
.feature p, .step p { color: var(--muted); font-size: .94rem; }
.feature { transition: transform .2s, border-color .2s; } .feature:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.f-ico { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.f-ico svg { width: 24px; height: 24px; }
.step-n { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); font-weight: 800; }
.faq { display: grid; gap: 10px; }
.faq details { padding: 0; }
.faq summary { cursor: pointer; padding: 16px 20px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--accent); line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 20px 18px; color: var(--muted); }

/* ---------- Footer / dialog / toasts ---------- */
.site-footer { margin-top: 80px; border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.footer-brand { display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.dialog { border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); width: min(520px, calc(100% - 32px)); padding: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.dialog::backdrop { background: rgba(5, 10, 20, .65); backdrop-filter: blur(3px); }
.dialog-inner { padding: 26px; display: grid; gap: 14px; }
#dlgBody { color: var(--muted); display: grid; gap: 10px; }
.dialog form { justify-self: end; }
.toasts { position: fixed; inset-inline-end: 16px; bottom: 16px; display: grid; gap: 10px; z-index: 200; width: min(360px, calc(100% - 32px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 600; animation: rise .25s ease both; border-inline-start: 4px solid var(--accent); }
.toast.ok { border-inline-start-color: var(--ok); } .toast.err { border-inline-start-color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .preview { grid-template-columns: 1fr; }
  .thumb { max-width: 420px; }
}
@media (max-width: 760px) {
  .menu-btn { display: grid; }
  .nav { position: absolute; inset-inline: 0; top: 64px; flex-direction: column; margin: 0; padding: 10px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--border); display: none; }
  .nav.open { display: flex; animation: rise .2s ease both; }
  .nav a { padding: 12px 14px; }
  .hero { padding-top: 40px; }
  .url-form { flex-wrap: wrap; }
  .url-form input { flex: 1 1 100%; }
  .url-form .btn { flex: 1; }
  .row-between { flex-direction: column; align-items: flex-start; }
  .h-item { grid-template-columns: minmax(0, 1fr); }
  .h-actions { justify-content: flex-start; }
}
