:root {
  --bg: #070b17;
  --bg-soft: #0d1324;
  --card: rgba(18, 26, 48, 0.8);
  --card-solid: #11192e;
  --text: #f7f9ff;
  --muted: #9aa7c2;
  --line: rgba(255,255,255,0.09);
  --primary: #6f5cff;
  --primary-2: #20d7c8;
  --primary-glow: rgba(111,92,255,0.28);
  --success: #36d399;
  --danger: #ff6685;
  --warning: #ffbf69;
  --shadow: 0 30px 80px rgba(0,0,0,0.32);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5f7fc;
  --bg-soft: #edf1f9;
  --card: rgba(255,255,255,0.88);
  --card-solid: #ffffff;
  --text: #10162a;
  --muted: #66728b;
  --line: rgba(15,23,42,0.10);
  --primary-glow: rgba(111,92,255,0.15);
  --shadow: 0 30px 70px rgba(36,49,80,0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(111,92,255,.20), transparent 39rem),
    var(--bg);
  color: var(--text);
  font-family: "Tajawal", system-ui, sans-serif;
  line-height: 1.6;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .18;
  pointer-events: none;
}
.ambient-one { top: 18rem; right: -10rem; background: #6f5cff; }
.ambient-two { top: 46rem; left: -12rem; background: #1dd8c7; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, var(--primary), #8d74ff);
  box-shadow: 0 12px 28px var(--primary-glow);
}

.brand-mark svg { width: 25px; height: 25px; }

.brand > span:last-child { display: flex; flex-direction: column; line-height: 1; }
.brand strong { font-size: 1.18rem; letter-spacing: -.02em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: .57rem; letter-spacing: .2em; }

.top-nav { display: flex; align-items: center; gap: 30px; }
.top-nav a { color: var(--muted); font-size: .92rem; font-weight: 600; transition: .2s; }
.top-nav a:hover { color: var(--text); }

.theme-button {
  justify-self: end;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: var(--card);
  cursor: pointer;
  transition: .2s;
}
.theme-button:hover { color: var(--text); transform: translateY(-2px); }
.theme-button svg { width: 20px; height: 20px; }

.hero {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 78px 0 72px;
  text-align: center;
}

.hero-badge {
  width: max-content;
  margin: 0 auto 22px;
  padding: 7px 13px;
  border: 1px solid rgba(111,92,255,.35);
  border-radius: 999px;
  background: rgba(111,92,255,.09);
  color: #b9aeff;
  font-size: .82rem;
  font-weight: 700;
}

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--primary-2);
  box-shadow: 0 0 0 0 rgba(32,215,200,.55);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(32,215,200,0); }
  100% { box-shadow: 0 0 0 0 rgba(32,215,200,0); }
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.05;
  letter-spacing: -.055em;
}

.hero h1 span {
  background: linear-gradient(90deg, #a99cff, #4de8d9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 640px;
  margin: 22px auto 18px;
  color: var(--muted);
  font-size: 1.08rem;
}

.platforms {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-bottom: 30px;
}

.platform {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

.mini-play { color: #ff4f65; }
.mini-note { color: #21dcd4; }

.downloader-card {
  position: relative;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: 27px;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(135deg, rgba(111,92,255,.30), rgba(32,215,200,.14), transparent) border-box;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  text-align: right;
}

.card-head,
.format-header,
.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-2);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.card-head h2,
.format-header h3 {
  margin: 0;
  font-size: 1.12rem;
}

.safe-chip,
.beta-chip,
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}

.safe-chip {
  color: var(--success);
  background: rgba(54,211,153,.09);
  border: 1px solid rgba(54,211,153,.18);
}
.safe-chip svg { width: 15px; height: 15px; }

.url-field-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 20px;
}

.url-field {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(0,0,0,.12);
  transition: .2s;
}

html[data-theme="light"] .url-field { background: rgba(18,25,47,.025); }

.url-field:focus-within {
  border-color: rgba(111,92,255,.72);
  box-shadow: 0 0 0 4px rgba(111,92,255,.09);
}

.link-icon {
  width: 49px;
  flex: 0 0 49px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.link-icon svg { width: 20px; height: 20px; }

.url-field input {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  direction: ltr;
  text-align: right;
}
.url-field input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); direction: rtl; }

.paste-button {
  flex: 0 0 auto;
  margin-left: 7px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: rgba(111,92,255,.12);
  color: #b8afff;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 800;
}

.analyze-button,
.download-button,
.dialog-action {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--primary), #816bff);
  box-shadow: 0 13px 27px var(--primary-glow);
  cursor: pointer;
  font-weight: 800;
  transition: .2s;
}

.analyze-button {
  min-width: 153px;
  height: 58px;
  padding: 0 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 15px;
}

.analyze-button svg { width: 18px; height: 18px; }
.analyze-button:hover,
.download-button:hover,
.dialog-action:hover { transform: translateY(-2px); filter: brightness(1.06); }
.analyze-button:disabled { opacity: .65; cursor: wait; transform: none; }

.spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.is-loading .spinner { display: inline-block; }
.is-loading .button-label,
.is-loading > svg { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.input-hint,
.connection-note {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: .74rem;
}

.connection-note { text-align: center; }
.connection-note code {
  direction: ltr;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,.05);
}

.message {
  display: none;
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: .83rem;
}
.message.error { display: block; color: #ff9aaf; background: rgba(255,102,133,.08); border: 1px solid rgba(255,102,133,.16); }
.message.success { display: block; color: #7ce5bc; background: rgba(54,211,153,.08); border: 1px solid rgba(54,211,153,.16); }

.result-panel {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  animation: reveal .32s ease both;
}
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

.video-preview {
  display: grid;
  grid-template-columns: 156px 1fr;
  gap: 18px;
  align-items: center;
}

.thumbnail-box {
  position: relative;
  height: 100px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--bg-soft);
}

.thumbnail-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumbnail-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(111,92,255,.18), rgba(32,215,200,.1));
}
.thumbnail-fallback svg { width: 30px; height: 30px; }

.source-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  color: white;
  background: rgba(9,13,25,.74);
  backdrop-filter: blur(8px);
}

.video-info { min-width: 0; }
.video-info h3 {
  margin: 0 0 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.03rem;
}
.video-info p { margin: 0; color: var(--muted); font-size: .82rem; }

.format-header { margin-top: 23px; }
.beta-chip { color: #b9aeff; background: rgba(111,92,255,.09); border: 1px solid rgba(111,92,255,.18); }

.format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.format-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  text-align: right;
  cursor: pointer;
  transition: .2s;
}

.format-option:hover { border-color: rgba(111,92,255,.34); }
.format-option.selected {
  border-color: rgba(111,92,255,.75);
  background: rgba(111,92,255,.08);
  box-shadow: 0 0 0 3px rgba(111,92,255,.06);
}

.format-icon {
  width: 44px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: .69rem;
  font-weight: 800;
  direction: ltr;
}
.video-format { color: #a99dff; background: rgba(111,92,255,.12); }
.audio-format { color: #4ce1d4; background: rgba(32,215,200,.1); }

.format-option strong,
.format-option small { display: block; }
.format-option strong { font-size: .91rem; }
.format-option small { color: var(--muted); font-size: .69rem; }

.check-circle {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: transparent;
  font-size: .7rem;
}
.selected .check-circle { color: white; border-color: var(--primary); background: var(--primary); }

.download-button {
  width: 100%;
  height: 55px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 14px;
}
.download-button svg { width: 20px; height: 20px; }

.trust-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 23px;
  color: var(--muted);
  font-size: .78rem;
}
.trust-row span { display: inline-flex; align-items: center; gap: 5px; }
.trust-row svg { width: 15px; height: 15px; color: var(--success); }

.section {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 78px 0;
}

.section-heading { max-width: 580px; margin: 0 auto 34px; text-align: center; }
.section-heading h2,
.feature-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.2;
  letter-spacing: -.035em;
}
.section-heading p,
.feature-copy > p { margin: 13px 0 0; color: var(--muted); }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.step-card {
  position: relative;
  min-height: 230px;
  padding: 25px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.step-number {
  position: absolute;
  top: 9px;
  left: 17px;
  color: rgba(255,255,255,.045);
  font-size: 4.7rem;
  font-weight: 800;
  line-height: 1;
}
html[data-theme="light"] .step-number { color: rgba(17,25,46,.045); }

.step-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #b7adff;
  background: rgba(111,92,255,.1);
}
.step-icon svg { width: 24px; height: 24px; }

.step-card h3 { margin: 22px 0 7px; font-size: 1.13rem; }
.step-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.feature-section {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: 70px;
}

.feature-list { margin-top: 28px; display: grid; gap: 17px; }
.feature-list > div { display: flex; align-items: flex-start; gap: 12px; }
.feature-list > div > span {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 8px;
  color: var(--success);
  background: rgba(54,211,153,.09);
  font-weight: 800;
}
.feature-list p { margin: 0; }
.feature-list strong,
.feature-list small { display: block; }
.feature-list small { margin-top: 2px; color: var(--muted); }

.status-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.status-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.live-status { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: .76rem; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.service-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}
.service-line:last-child { border-bottom: 0; padding-bottom: 0; }
.service-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.service-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: .67rem;
}
.service-icon.youtube { color: #ff6477; background: rgba(255,79,101,.09); }
.service-icon.tiktok { color: #45e5d8; background: rgba(32,215,200,.09); }
.service-icon.api { color: #b8afff; background: rgba(111,92,255,.1); }
.status-text { color: var(--success); font-size: .76rem; font-weight: 700; }
.status-text.warning { color: var(--warning); }
.muted-service { opacity: .86; }

.legal-strip {
  width: min(1100px, calc(100% - 32px));
  margin: 10px auto 65px;
  padding: 19px 23px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(255,191,105,.16);
  border-radius: 17px;
  color: var(--muted);
  background: rgba(255,191,105,.045);
}
.legal-strip svg { width: 25px; height: 25px; flex: 0 0 25px; color: var(--warning); }
.legal-strip p { margin: 0; font-size: .84rem; }

.site-footer {
  width: min(1180px, calc(100% - 40px));
  min-height: 120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
}
.footer-brand .brand-mark { width: 37px; height: 37px; }
.footer-brand .brand-mark svg { width: 22px; height: 22px; }
.footer-links { display: flex; gap: 20px; color: var(--muted); font-size: .8rem; }
.site-footer > p { justify-self: end; margin: 0; color: var(--muted); font-size: .74rem; }

.app-dialog {
  width: min(440px, calc(100% - 28px));
  padding: 29px;
  border: 1px solid var(--line);
  border-radius: 23px;
  color: var(--text);
  background: var(--card-solid);
  box-shadow: var(--shadow);
  text-align: center;
}
.app-dialog::backdrop { background: rgba(2,5,12,.72); backdrop-filter: blur(5px); }
.dialog-close {
  position: absolute;
  top: 10px;
  left: 13px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 1.7rem;
}
.dialog-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #b8afff;
  background: rgba(111,92,255,.1);
}
.dialog-icon svg { width: 27px; height: 27px; }
.app-dialog h2 { margin: 0 0 9px; font-size: 1.35rem; }
.app-dialog p { margin: 0; color: var(--muted); font-size: .9rem; }
.dialog-action { min-width: 130px; margin-top: 21px; padding: 11px 20px; border-radius: 12px; }

.legal-page {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 60px 0 90px;
}
.legal-page h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.04em; }
.legal-page h2 { margin-top: 35px; }
.legal-page p, .legal-page li { color: var(--muted); }
.legal-page a { color: #a99cff; }

@media (max-width: 780px) {
  .site-header { grid-template-columns: 1fr auto; min-height: 74px; }
  .top-nav { display: none; }
  .hero { padding-top: 56px; }
  .downloader-card { padding: 19px; border-radius: 21px; }
  .url-field-wrap { grid-template-columns: 1fr; }
  .analyze-button { width: 100%; }
  .video-preview { grid-template-columns: 115px 1fr; }
  .thumbnail-box { height: 82px; }
  .steps { grid-template-columns: 1fr; }
  .feature-section { grid-template-columns: 1fr; gap: 36px; }
  .site-footer { grid-template-columns: 1fr; justify-items: center; padding: 26px 0; text-align: center; }
  .site-footer > p { justify-self: center; }
}

@media (max-width: 520px) {
  .site-header { width: min(100% - 26px, 1180px); }
  .hero h1 { font-size: 2.75rem; }
  .hero-copy { font-size: .95rem; }
  .card-head { align-items: flex-start; }
  .safe-chip { font-size: 0; width: 36px; height: 36px; padding: 0; justify-content: center; }
  .safe-chip svg { width: 18px; height: 18px; }
  .url-field input { font-size: .82rem; }
  .format-grid { grid-template-columns: 1fr; }
  .video-preview { grid-template-columns: 1fr; }
  .thumbnail-box { height: 180px; }
  .video-info h3 { white-space: normal; }
  .trust-row { gap: 11px; }
  .site-footer { width: min(100% - 26px, 1180px); }
}


/* Supported-platform styling */
.mini-instagram { color: #f06ac6; font-weight: 900; }
.mini-facebook { color: #64a0ff; font-weight: 900; font-family: Arial, sans-serif; }
.mini-x { color: var(--text); font-weight: 900; font-family: Arial, sans-serif; }

.service-icon.instagram {
  color: #f18acb;
  background: rgba(240, 106, 198, .10);
}
.service-icon.facebook {
  color: #76aaff;
  background: rgba(74, 134, 232, .10);
  font-family: Arial, sans-serif;
  font-weight: 900;
}
.service-icon.twitter {
  color: var(--text);
  background: rgba(255, 255, 255, .07);
  font-family: Arial, sans-serif;
  font-weight: 900;
}

.source-badge[data-platform="youtube"] { border: 1px solid rgba(255,79,101,.32); }
.source-badge[data-platform="tiktok"] { border: 1px solid rgba(32,215,200,.32); }
.source-badge[data-platform="instagram"] { border: 1px solid rgba(240,106,198,.32); }
.source-badge[data-platform="facebook"] { border: 1px solid rgba(74,134,232,.32); }
.source-badge[data-platform="twitter"] { border: 1px solid rgba(255,255,255,.20); }

.download-button:disabled {
  opacity: .7;
  cursor: wait;
  transform: none;
}

@media (max-width: 600px) {
  .platforms {
    max-width: 370px;
    margin-left: auto;
    margin-right: auto;
    flex-wrap: wrap;
  }
}

.thumbnail-fallback {
  gap: 5px;
  align-content: center;
}
.thumbnail-fallback small {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
}


.thumbnail-box img.is-hidden {
  display: none !important;
}

.thumbnail-fallback[hidden] {
  display: none !important;
}


.video-info h3 {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal !important;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  max-height: 4.8em;
}

.video-info p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Simplified landing layout */
.quick-note {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1.1rem;
  border-radius: 18px;
  background: rgba(13, 22, 46, .72);
  border: 1px solid rgba(133, 152, 196, .18);
  color: var(--muted);
}

.quick-note span {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(122, 92, 255, .18);
  color: var(--primary);
  font-weight: 800;
  flex: 0 0 auto;
}

.quick-note p {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.top-nav a[href="#how"],
.top-nav a[href="#features"] {
  display: none !important;
}
