:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --text: #111114;
  --text-2: #3f3f46;
  --muted: #71717a;
  --border: #e6e6ea;
  --red: #e5112b;
  --red-hover: #c90d24;
  --red-soft: #fff0f2;
  --red-ring: rgba(229, 17, 43, .16);
  --green: #12a150;
  --green-soft: #e8f8ef;
  --shadow: 0 1px 2px rgba(16, 16, 20, .04), 0 8px 24px rgba(16, 16, 20, .06);
  --shadow-lg: 0 2px 4px rgba(16, 16, 20, .04), 0 20px 48px rgba(16, 16, 20, .10);
  --radius: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0c0e;
  --bg-soft: #121215;
  --surface: #17171b;
  --surface-2: #1f1f24;
  --text: #f4f4f6;
  --text-2: #d4d4d8;
  --muted: #9a9aa3;
  --border: #2a2a30;
  --red: #ff3049;
  --red-hover: #ff5468;
  --red-soft: #2a1116;
  --red-ring: rgba(255, 48, 73, .22);
  --green: #3ddc84;
  --green-soft: #10261a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 48px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e;
    --bg-soft: #121215;
    --surface: #17171b;
    --surface-2: #1f1f24;
    --text: #f4f4f6;
    --text-2: #d4d4d8;
    --muted: #9a9aa3;
    --border: #2a2a30;
    --red: #ff3049;
    --red-hover: #ff5468;
    --red-soft: #2a1116;
    --red-ring: rgba(255, 48, 73, .22);
    --green: #3ddc84;
    --green-soft: #10261a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 48px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: inherit; }
b { font-weight: 600; color: var(--text); }
code { font: 600 .92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--red-ring); outline-offset: 2px; }

.wrap { max-width: 860px; margin: 0 auto; padding-inline: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--red); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px var(--red-ring); }
.logo-mark svg { width: 17px; height: 17px; stroke-width: 2.8; }
.logo-tld { color: var(--muted); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 26px; font-size: 14px; font-weight: 500; }
.nav a { text-decoration: none; color: var(--muted); transition: color .15s; }
.nav a:hover { color: var(--text); }
.icon-btn { background: var(--surface-2); border: 0; color: var(--text); cursor: pointer; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--border); }
.show-dark { display: none; }
:root[data-theme="dark"] .show-dark { display: block; }
:root[data-theme="dark"] .show-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .show-dark { display: block; }
  :root:not([data-theme="light"]) .show-light { display: none; }
}

/* ---------- hero ---------- */
.hero {
  text-align: center; padding: 56px 0 36px; position: relative; overflow: hidden;
  background:
    radial-gradient(600px 260px at 50% -40px, var(--red-ring), transparent 70%),
    var(--bg);
}
.pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 5px 14px;
  box-shadow: var(--shadow);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.hero h1 { font-size: clamp(32px, 6.4vw, 56px); line-height: 1.06; letter-spacing: -.04em; margin: 0 0 16px; font-weight: 800; }
.accent { color: var(--red); }
.sub { color: var(--muted); margin: 0 auto 30px; font-size: clamp(15px, 2.2vw, 18px); max-width: 520px; }

/* ---------- search ---------- */
.search {
  display: flex; gap: 8px; max-width: 720px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 8px;
  box-shadow: var(--shadow-lg); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--red); box-shadow: var(--shadow-lg), 0 0 0 4px var(--red-ring); }
.input-box { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding-inline-start: 12px; }
.link-ic { color: var(--muted); width: 18px; height: 18px; }
.input-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; height: 48px; }
.input-box input::placeholder { color: var(--muted); }
.ghost-btn { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; padding: 8px 10px; border-radius: 10px; }
.ghost-btn:hover { color: var(--text); background: var(--surface-2); }
.ghost-btn svg { width: 16px; height: 16px; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: #fff; border: 0; border-radius: 12px; padding: 0 26px; height: 48px;
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--red-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); color: var(--text); border: 0; border-radius: 12px; padding: 0 20px; height: 48px;
  font-weight: 600; font-size: 15px; cursor: pointer;
}
.btn-secondary:hover { background: var(--border); }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  display: flex; align-items: center; gap: 10px; max-width: 720px; margin: 14px auto 0; text-align: start;
  background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 12px 16px; font-size: 14px; font-weight: 500;
  animation: rise .25s ease;
}
.trick { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.trick svg { width: 15px; height: 15px; color: var(--red); }

.recent { max-width: 720px; margin: 26px auto 0; text-align: start; }
.recent-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-transform: none; letter-spacing: 0; }
.link-btn:hover { color: var(--red); }
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.recent-item {
  display: flex; gap: 10px; align-items: center; text-align: start; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; cursor: pointer; color: var(--text); min-width: 0;
}
.recent-item:hover { border-color: var(--red); }
.recent-item img { width: 64px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; flex: none; background: var(--surface-2); }
.recent-item span { font-size: 13px; font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }

/* ---------- result ---------- */
.result {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px;
  box-shadow: var(--shadow-lg); margin: 4px auto 40px; max-width: 720px; animation: rise .3s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.video-meta { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.thumb-wrap { position: relative; flex: none; width: 200px; }
.thumb-wrap img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.duration { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.78); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 5px; }
.duration:empty { display: none; }
.meta-text { min-width: 0; }
.meta-text h2 { font-size: 18px; line-height: 1.35; margin: 0 0 6px; letter-spacing: -.01em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.meta-text p { margin: 0; font-size: 14px; }

/* skeleton */
.result.loading .thumb-wrap img, .result.loading .meta-text h2, .result.loading .meta-text p, .result.loading .rows li {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear; color: transparent; border-color: transparent;
}
.result.loading .meta-text h2 { height: 22px; width: 90%; border-radius: 6px; }
.result.loading .meta-text p { height: 14px; width: 40%; border-radius: 6px; }
.result.loading .rows li { height: 58px; }
.result.loading .rows li > * { visibility: hidden; }
.result.loading .segmented { opacity: .5; pointer-events: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; background: none; border: 0; padding: 9px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.seg svg { width: 16px; height: 16px; }
.seg.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 14px; padding-block: 10px; padding-inline: 16px 10px;
  border: 1px solid var(--border); border-radius: 14px; transition: border-color .15s, background .15s;
}
.row:hover { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.row.best { border-color: var(--red); background: var(--red-soft); }
.q { font-weight: 700; font-size: 16px; min-width: 64px; letter-spacing: -.01em; }
.q-sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tags { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); letter-spacing: .02em; }
.tag.red { background: var(--red); color: #fff; }
.tag.green { background: var(--green-soft); color: var(--green); }
.size { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn-row {
  display: inline-flex; align-items: center; gap: 6px; background: var(--red); color: #fff; border: 0; border-radius: 10px;
  padding: 0 16px; height: 38px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-row:hover { background: var(--red-hover); }
.btn-row:disabled { opacity: .4; cursor: not-allowed; }
.btn-row svg { width: 15px; height: 15px; }
.empty { padding: 20px; text-align: center; color: var(--muted); }

/* progress */
.progress { padding: 8px 2px 4px; }
.progress-top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; gap: 12px; }
.stage { margin: 0; font-weight: 600; font-size: 16px; }
.progress .small { margin: 2px 0 0; min-height: 20px; font-variant-numeric: tabular-nums; }
.pct { font-size: 28px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--red); }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar div {
  height: 100%; width: 0; border-radius: 99px; transition: width .5s ease;
  background: linear-gradient(90deg, var(--red), #ff6a3d);
  background-size: 200% 100%;
}
.progress.indeterminate .bar div { width: 35% !important; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }

/* done */
.done { text-align: center; padding: 8px 0 4px; animation: rise .3s ease; }
.done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; margin: 0 auto 12px; }
.done-icon svg { width: 28px; height: 28px; stroke-width: 2.6; }
.done-title { font-weight: 700; font-size: 18px; margin: 0 0 4px; }
.done p.small { margin: 0 auto 18px; max-width: 460px; word-break: break-word; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- ads ---------- */
.ad-slot { margin: 0 auto 40px; max-width: 728px; text-align: center; }
.ad-slot:empty { display: none; }

/* ---------- sections ---------- */
.section { margin: 0 0 64px; }
.section-title { font-size: clamp(22px, 3.4vw, 28px); letter-spacing: -.03em; margin: 0 0 20px; text-align: center; font-weight: 800; }
.section p { color: var(--text-2); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.step-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--red); color: #fff; font-weight: 800; font-size: 15px; margin-bottom: 14px; }
.step h3, .feature h3, .device h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: -.01em; }
.step p, .feature p, .device p { margin: 0; font-size: 14px; color: var(--muted); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.f-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--red-soft); color: var(--red); margin-bottom: 14px; }
.f-ic svg { width: 20px; height: 20px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.info-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 540px; }
.info-table th { text-align: start; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 16px; background: var(--bg-soft); }
.info-table td { padding: 13px 16px; border-top: 1px solid var(--border); color: var(--text-2); }

.devices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.device { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }

.faq { display: grid; gap: 8px; max-width: 720px; margin: 0 auto; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; transition: border-color .15s; }
.faq details[open] { border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.faq summary { list-style: none; cursor: pointer; padding: 16px 18px; font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; font-weight: 400; color: var(--muted); line-height: 1; transition: transform .2s; flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--red); }
.faq details p { padding: 0 18px 16px; margin: 0; color: var(--muted) !important; font-size: 14px; }

/* mp3 page intro */
.intro-body { max-width: 720px; margin: 0 auto; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.intro-body p { margin: 0 0 10px; }
.intro-body p:last-child { margin: 0; }
.bullets { margin: 0 0 10px; padding-inline-start: 20px; color: var(--text-2); }
.bullets li { margin-bottom: 6px; }

/* language menu */
.lang { position: relative; }
.lang summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
  border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 13px;
}
.lang summary:hover, .lang[open] summary { color: var(--text); background: var(--surface-2); }
.lang summary svg { width: 16px; height: 16px; }
.lang-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 150px; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-lg);
  display: grid;
}
.lang-menu a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.lang-menu a:hover { background: var(--surface-2); }
.lang-menu a.active { color: var(--red); background: var(--red-soft); }

/* right-to-left (Arabic) */
:root[lang="ar"] body, :root[lang="ar"] button, :root[lang="ar"] input {
  font-family: "IBM Plex Sans Arabic", Inter, system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
}
:root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] h3, :root[lang="ar"] .logo { letter-spacing: 0; }
:root[lang="ar"] .hero h1 { line-height: 1.25; }
[dir="rtl"] .flip { transform: scaleX(-1); }
[dir="rtl"] .input-box input:placeholder-shown { direction: rtl; }

/* ---------- footer ---------- */
.footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding: 36px 0 calc(28px + env(safe-area-inset-bottom, 0px)); }
.footer-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.footer-brand { max-width: 380px; }
.footer-brand p { margin: 10px 0 0; }
.footer-links { display: flex; gap: 22px; font-size: 14px; flex-wrap: wrap; }
.footer-links a { text-decoration: none; color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer > .wrap > p { margin: 6px 0; }

/* ---------- legal pages ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 48px 20px 64px; }
.page h1 { font-size: 34px; letter-spacing: -.03em; margin: 0 0 6px; }
.page h2 { font-size: 19px; margin: 32px 0 8px; }
.page p, .page li { color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .steps, .features, .devices { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding-inline: 16px; }
  .nav > a { display: none; }
  .nav { gap: 8px; }
  .hero { padding: 36px 0 24px; }
  .search { flex-direction: column; padding: 6px; }
  .input-box { padding-inline-start: 10px; }
  .btn-primary { width: 100%; }
  .paste span { display: none; }
  .result { padding: 14px; border-radius: 18px; }
  .video-meta { flex-direction: column; align-items: stretch; gap: 12px; }
  .thumb-wrap { width: 100%; }
  .meta-text h2 { font-size: 16px; }
  .row { padding-inline: 12px 10px; gap: 10px; }
  .tags { display: none; }
  .row .size { margin-inline-start: auto; }
  .features { grid-template-columns: 1fr; }
  .done-actions > * { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
