/* vid2tune — mobile-first. Base styles target phones; min-width queries add room for larger screens. */

:root {
  --bg: #f6f5fb;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: rgba(20, 12, 60, 0.045);
  --text: #0f0d1a;
  --muted: #5d5a6e;
  --border: rgba(15, 13, 26, 0.08);
  --border-strong: rgba(15, 13, 26, 0.14);
  --accent: #6d4aff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(109, 74, 255, 0.1);
  --grad: linear-gradient(135deg, #6d4aff 0%, #b44dff 52%, #ff4f8b 100%);
  --grad-soft: linear-gradient(135deg, rgba(109, 74, 255, 0.14), rgba(255, 79, 139, 0.12));
  --ok: #0f9d63;
  --err: #d92d4b;
  --wave-dim: #d3cfe3;
  --wave-on: #6d4aff;
  --wave-sel: rgba(109, 74, 255, 0.1);
  --glow-1: rgba(109, 74, 255, 0.28);
  --glow-2: rgba(255, 79, 139, 0.2);
  --shadow: 0 1px 2px rgba(20, 12, 60, 0.04), 0 12px 40px -12px rgba(60, 30, 160, 0.22);
  --shadow-btn: 0 10px 30px -10px rgba(109, 74, 255, 0.7);
  --radius-lg: 28px;
  --radius: 18px;
  --radius-sm: 14px;
  --tabbar-h: 68px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0a12;
    --surface: rgba(26, 23, 40, 0.66);
    --surface-solid: #16141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --text: #f3f1fa;
    --muted: #a19db3;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --accent: #9b7dff;
    --accent-ink: #ffffff;
    --accent-soft: rgba(155, 125, 255, 0.14);
    --ok: #34d399;
    --err: #ff7a90;
    --wave-dim: #3a3650;
    --wave-on: #a58bff;
    --wave-sel: rgba(155, 125, 255, 0.14);
    --glow-1: rgba(109, 74, 255, 0.35);
    --glow-2: rgba(255, 79, 139, 0.22);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 60px -20px rgba(0, 0, 0, 0.7);
    --shadow-btn: 0 10px 30px -10px rgba(140, 100, 255, 0.6);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
[dir="rtl"] body { font-family: var(--font), "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
a { color: var(--accent); }
img, svg, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.ico { width: 22px; height: 22px; flex: none; }

/* Soft gradient light behind everything. */
.bg-glow {
  position: fixed; inset: -20vh -30vw auto; height: 90vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 25% 30%, var(--glow-1), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, var(--glow-2), transparent 70%);
  filter: blur(40px);
  animation: glow 18s ease-in-out infinite alternate;
}
@keyframes glow { to { transform: translate3d(0, 4vh, 0) scale(1.08); } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.wordmark span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: none; }

.lang-menu { position: relative; margin-inline-start: auto; }
.lang-menu summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  height: 40px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary .ico { width: 18px; height: 18px; color: var(--muted); }
.lang-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 170px; padding: 6px;
  display: grid; background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 30;
}
.lang-list a { padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 15px; }
.lang-list a:hover { background: var(--surface-2); }
.lang-list a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar {
  position: fixed; inset: auto 0 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 6px 6px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; line-height: 1.2;
  border-radius: 14px; min-width: 0; text-align: center;
}
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabbar .ico { width: 24px; height: 24px; padding: 3px 12px; box-sizing: content-box; border-radius: 999px; transition: background .2s; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"] .ico { background: var(--accent-soft); }

/* ---------- hero ---------- */
.hero { padding: 28px 0 18px; text-align: center; }
.hero-ico {
  display: inline-grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px;
  border-radius: 18px; background: var(--grad); color: #fff; box-shadow: var(--shadow-btn);
}
.hero-ico .ico { width: 28px; height: 28px; }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(32px, 9vw, 60px); line-height: 1.05; font-weight: 800; letter-spacing: -0.045em;
  background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--text) 62%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0 auto; max-width: 560px; color: var(--muted); font-size: 16px; }
.badges { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.badge {
  font-size: 12px; font-weight: 600; color: var(--muted); padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(8px);
}

/* ---------- tool card ---------- */
.tool {
  position: relative; margin: 8px 0 10px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.privacy-note { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 0; }

.btn-primary, .btn-secondary, .btn-download {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 1px solid transparent;
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
}
.btn-primary { width: 100%; background: var(--grad); color: var(--accent-ink); box-shadow: var(--shadow-btn); }
.btn-primary:hover { box-shadow: 0 14px 36px -10px rgba(109, 74, 255, 0.85); }
.btn-primary:active, .btn-download:active, .btn-secondary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); min-height: 46px; font-size: 15px; }
.btn-download { background: var(--text); color: var(--bg); min-height: 48px; font-size: 15px; }
.btn-download:disabled { opacity: .5; cursor: not-allowed; }

select {
  -webkit-appearance: none; appearance: none; width: 100%; min-height: 48px; padding: 0 40px 0 14px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--text);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a86a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
[dir="rtl"] select:not([dir="ltr"]) { padding: 0 14px 0 40px; background-position: left 14px center; }

/* ---------- dropzone converter ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 30px 16px; border: 2px dashed var(--border-strong); border-radius: 22px; cursor: pointer;
  background: var(--grad-soft); transition: border-color .2s, transform .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.dz-bubble { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 6px; border-radius: 20px; background: var(--grad); color: #fff; box-shadow: var(--shadow-btn); }
.dz-icon { width: 30px; height: 30px; }
.dz-title { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.dz-sub { color: var(--muted); font-size: 13px; }
.is-busy .dropzone { opacity: .5; pointer-events: none; }
.dropzone.has-file { flex-direction: row; padding: 12px 14px; gap: 12px; }
.dropzone.has-file .dz-bubble { width: 40px; height: 40px; margin: 0; border-radius: 12px; }
.dropzone.has-file .dz-icon { width: 20px; height: 20px; }
.dropzone.has-file .dz-title { font-size: 15px; }
.dropzone.has-file .dz-sub { display: none; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.options .btn-primary { grid-column: 1 / -1; }
.bitrate-field[hidden] + .btn-primary { grid-column: 1 / -1; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.file-row { padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.file-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-size { color: var(--muted); flex: none; }
.progress { height: 6px; margin: 10px 0; overflow: hidden; border-radius: 999px; background: var(--border); }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--grad); transition: width .2s; }
.file-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.file-status { font-size: 13px; color: var(--muted); }
.file-actions { display: flex; flex: 1 1 100%; }
.file-actions:empty { display: none; }
.file-actions .btn-download { width: 100%; }
.file-row[data-state="done"] .file-status { color: var(--ok); font-weight: 600; }
.file-row[data-state="done"] .progress-bar { background: var(--ok); }
.file-row[data-state="error"] .file-status { color: var(--err); }
#download-all { width: 100%; margin-top: 12px; }

/* ---------- trimmer ---------- */
.trim-panel { margin-top: 14px; }
.wave { width: 100%; height: 110px; border-radius: var(--radius); background: var(--surface-2); cursor: pointer; touch-action: none; }
.trim-grid { display: grid; gap: 12px; margin-top: 12px; }
.trim-grid label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); }
.trim-grid output { color: var(--text); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 28px; accent-color: var(--accent); }
.trim-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; font-size: 14px; }
.trim-bar .btn-secondary { flex: 1 1 100%; }
.trim-bar label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.trim-bar input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
#trim-len { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
#trim-len.is-warn { color: var(--err); }
.wave, .trim-grid input[type="range"] { direction: ltr; }

/* ---------- link downloader ---------- */
.link-form { display: grid; gap: 10px; }
.link-field { position: relative; }
.link-field input {
  width: 100%; min-height: 58px; padding: 0 16px; padding-inline-end: 100px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-solid); border: 1.5px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s;
}
.link-field input::placeholder { color: var(--muted); opacity: .8; }
.link-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.link-form input:not(:placeholder-shown) { direction: ltr; }
.link-paste {
  position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px;
  border: 0; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer;
}
.link-paste .ico { width: 18px; height: 18px; }
.link-sites { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.link-offline { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 14px; text-align: center; }
.link-offline a { display: inline-block; margin-top: 2px; font-weight: 700; }
.link-status { margin: 12px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.link-status:empty { display: none; }
.link-status.is-error { color: var(--err); }
.link-result {
  display: grid; gap: 14px; margin-top: 14px; padding: 12px;
  border-radius: 22px; background: var(--surface-2); border: 1px solid var(--border);
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.link-thumb { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 16px; background: var(--border); }
.link-title { margin: 0 0 4px; font-size: 17px; line-height: 1.35; letter-spacing: -0.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-meta { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.link-row { display: grid; grid-template-columns: 132px 1fr; gap: 8px; margin-top: 8px; }
.link-progress { margin-top: 14px; }
.link-progress.is-waiting .progress-bar { width: 30% !important; animation: wait 1.2s ease-in-out infinite alternate; }
@keyframes wait { from { transform: translateX(-100%); } to { transform: translateX(330%); } }

/* ---------- content ---------- */
.content { padding: 12px 0 8px; }
.content h2 { margin: 40px 0 14px; font-size: 24px; line-height: 1.2; letter-spacing: -0.035em; font-weight: 800; }
.content p, .content li { color: var(--muted); }
.content strong { color: var(--text); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.steps li {
  position: relative; display: grid; gap: 2px; padding: 16px; padding-inline-start: 64px; counter-increment: s;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.steps li::before {
  content: counter(s); position: absolute; inset-inline-start: 16px; top: 16px;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 15px;
}
.steps strong { font-size: 16px; }
.steps span { font-size: 14px; }

.faq { display: grid; gap: 8px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.faq summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px; font-weight: 700; color: var(--text); cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); font-size: 18px; font-weight: 500; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0; padding: 0 16px 16px; }

.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tools-grid a {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; min-height: 124px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: transform .2s, border-color .2s;
}
.tools-grid a:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile-ico { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.tile-ico .ico { width: 20px; height: 20px; }
.tools-grid strong { font-size: 15px; line-height: 1.3; letter-spacing: -0.01em; }
.tools-grid span:last-child { font-size: 12.5px; line-height: 1.4; color: var(--muted); }

.prose { max-width: 680px; }
.prose h1 { margin: 32px 0 16px; font-size: 34px; line-height: 1.1; letter-spacing: -0.04em; }

/* ---------- footer ---------- */
.site-footer { margin-top: 48px; padding: 24px 0 28px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ---------- ≥ 600px: tablets ---------- */
@media (min-width: 600px) {
  .wrap { padding: 0 24px; }
  .hero { padding: 48px 0 24px; }
  .hero p { font-size: 18px; }
  .tool { padding: 20px; }
  .options { display: flex; align-items: flex-end; }
  .options .field { flex: 1; }
  .options .btn-primary { width: auto; min-width: 200px; }
  .file-actions { flex: 0 0 auto; }
  .file-actions .btn-download { width: auto; }
  .trim-grid { grid-template-columns: 1fr 1fr; gap: 12px 20px; }
  .trim-bar .btn-secondary { flex: 0 0 auto; }
  .link-form { grid-template-columns: 1fr auto; }
  .link-form .btn-primary { width: auto; min-width: 170px; min-height: 58px; }
  .link-result { grid-template-columns: 200px 1fr; align-items: start; padding: 14px; }
  .link-thumb { aspect-ratio: 4 / 5; }
  .link-row { grid-template-columns: 140px auto; justify-content: start; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { padding: 64px 18px 18px; }
  .steps li::before { top: 18px; inset-inline-start: 18px; }
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
  .content h2 { font-size: 28px; margin-top: 56px; }
}

/* ---------- ≥ 900px: desktop — top nav replaces the tab bar ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .site-header .wrap { height: 68px; gap: 20px; }
  .nav {
    display: flex; gap: 2px; margin-inline-start: auto; padding: 4px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  }
  .nav a { padding: 7px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; transition: color .2s, background .2s; }
  .nav a:hover { color: var(--text); }
  .nav a[aria-current="page"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(20, 12, 60, 0.12); }
  .lang-menu { margin-inline-start: 0; }
  .hero { padding: 72px 0 32px; }
  .hero-ico { width: 64px; height: 64px; border-radius: 20px; }
  .tool { padding: 24px; }
  .tools-grid { grid-template-columns: repeat(4, 1fr); }
  .site-footer .wrap { flex-direction: row; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .link-progress.is-waiting .progress-bar { width: 100% !important; opacity: .4; }
}
