/* ClipMagic: mobile first. Logical properties (inline/block) so one stylesheet serves RTL (he, ar) and LTR. */
:root {
  --bg: #0f0c22; --bg2: #151130; --panel: #1b1736; --panel2: #241f45; --line: #342d63;
  --text: #f4f2ff; --muted: #a49ec6; --violet: #8b6cff; --cyan: #3dd6f5;
  --ok: #3ddc97; --warn: #ffc65c; --bad: #ff6b81;
  --grad: linear-gradient(120deg, var(--violet), var(--cyan));
  --r: 18px; --tabs: 68px;
  --font: Heebo, "Noto Sans", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.55 var(--font); min-height: 100dvh; -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(139, 108, 255, .16), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, rgba(61, 214, 245, .08), transparent 60%), var(--bg); background-attachment: fixed; }
a { color: var(--cyan); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 10px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  position: sticky; top: 0; z-index: 10; background: rgba(15, 12, 34, .78); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid rgba(52, 45, 99, .6); }
.brand { font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; display: flex; gap: 9px; align-items: center; direction: ltr; letter-spacing: -.01em; }
.spark { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); box-shadow: 0 0 22px rgba(139, 108, 255, .55); position: relative; }
.spark::after { content: ""; position: absolute; inset: 7px 6px 7px 9px; background: #0f0c22; clip-path: polygon(0 0, 100% 50%, 0 100%); }
#nav { display: flex; gap: 6px; align-items: center; }
#nav a, #nav .link { font-size: 14px; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 8px 10px; border-radius: 10px; }
#nav a.on { color: var(--text); background: var(--panel); }
#nav .wide { display: none; }
.langpick { display: flex; align-items: center; gap: 4px; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; margin: 0; font-weight: 500; cursor: pointer; }
.langpick select { background: transparent; border: 0; padding: 4px 0; width: auto; font-size: 14px; color: var(--text); cursor: pointer; }
.langpick select option { background: var(--panel); }
.chip-btn { display: flex; align-items: center; gap: 6px; background: var(--grad); color: #0f0c22; border: 0; border-radius: 999px;
  padding: 7px 12px; font-size: 13px; font-weight: 800; cursor: pointer; }
.chip-btn span { display: none; }

/* bottom tabs (phones) */
.tabs { display: none; }
body.has-tabs .tabs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
  height: calc(var(--tabs) + env(safe-area-inset-bottom)); padding: 0 16px env(safe-area-inset-bottom);
  background: rgba(21, 17, 48, .9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; padding: 6px; }
.tabs a.on { color: var(--text); }
.tabs a.on svg { color: var(--cyan); }
.tabs .fab { width: 58px; height: 58px; border-radius: 20px; background: var(--grad); color: #0f0c22; justify-content: center; margin-top: -22px;
  box-shadow: 0 10px 30px rgba(139, 108, 255, .45), 0 0 0 6px var(--bg); }
body.has-tabs main { padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + 28px); }

main { max-width: 820px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); }
h1 { font-size: 27px; font-weight: 800; margin: 6px 0 14px; letter-spacing: -.01em; line-height: 1.2; }
h2 { font-size: 18px; margin: 26px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.desk { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 20px; min-height: 48px;
  font-weight: 700; cursor: pointer; text-decoration: none; background: var(--panel2); color: var(--text); transition: transform .12s, box-shadow .2s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--grad); color: #0f0c22; box-shadow: 0 8px 24px rgba(139, 108, 255, .3); }
.btn.lg { font-size: 17px; padding: 15px 24px; min-height: 54px; border-radius: 16px; }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }

.card { background: linear-gradient(180deg, rgba(36, 31, 69, .55), rgba(27, 23, 54, .85)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.card.err, .err { color: var(--bad); }
.note { background: rgba(61, 214, 245, .07); border: 1px solid rgba(61, 214, 245, .25); color: #cdeff7; border-radius: 14px; padding: 12px 14px;
  font-size: 14px; margin: 10px 0; display: flex; gap: 8px; align-items: flex-start; }
.note.ok { background: rgba(61, 220, 151, .08); border-color: rgba(61, 220, 151, .3); color: #c9f6e2; }
.note svg { flex: none; margin-top: 2px; }

/* hero */
.hero { text-align: center; padding: 56px 4px 40px; position: relative; }
.hero h1 { font-size: clamp(30px, 8vw, 46px); line-height: 1.12; margin-bottom: 16px; }
.hero .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.hero .lead { font-size: 17px; max-width: 560px; margin: 0 auto 26px; }
.orb { width: 140px; height: 140px; margin: 0 auto 26px; border-radius: 40px; background: var(--grad); position: relative;
  box-shadow: 0 30px 80px rgba(139, 108, 255, .45); animation: float 5s ease-in-out infinite; }
.orb::after { content: ""; position: absolute; inset: 42px 38px 42px 52px; background: var(--bg); clip-path: polygon(0 0, 100% 50%, 0 100%); border-radius: 4px; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-3deg); } }

/* new video */
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 26px 16px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(27, 23, 54, .5); }
.drop.over, .drop:hover { border-color: var(--cyan); background: rgba(61, 214, 245, .06); }
.drop input { display: none; }
.drop-ic { width: 52px; height: 52px; border-radius: 16px; background: var(--grad); color: #0f0c22; display: grid; place-items: center; margin-bottom: 4px; }
.files { list-style: none; padding: 0; margin: 12px 0 0; }
.files li { background: var(--panel2); border-radius: 14px; padding: 12px; margin: 8px 0; }
.files .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.files .name { font-weight: 700; overflow-wrap: anywhere; }
.files .name em { font-style: normal; font-size: 12px; background: var(--grad); color: #0f0c22; padding: 2px 8px; border-radius: 999px; margin-inline-end: 4px; }
.files .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 22px; min-width: 40px; min-height: 40px; }
.files input { margin-top: 8px; }
.bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }

.modes { display: grid; grid-template-columns: 1fr; gap: 10px; }
.mode { text-align: start; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.mode b { display: block; margin-bottom: 4px; font-size: 16px; }
.mode span { color: var(--muted); font-size: 14px; line-height: 1.45; }
.mode.on { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139, 108, 255, .16); background: var(--panel2); }

label { display: block; font-weight: 700; margin: 18px 0 6px; }
input[type=text], input[type=email], textarea, select { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; min-height: 48px; font-size: 16px; }
input:focus, textarea:focus, select:focus { border-color: var(--violet); outline: none; box-shadow: 0 0 0 3px rgba(139, 108, 255, .2); }
textarea { min-height: 96px; resize: vertical; }
.inline { display: flex; gap: 10px; }
.inline > * { flex: 1; min-width: 0; }
.sticky-go { position: sticky; bottom: calc(var(--tabs) + env(safe-area-inset-bottom)); margin: 18px -16px 0; padding: 14px 16px 12px; z-index: 5;
  background: linear-gradient(to top, var(--bg) 70%, rgba(15, 12, 34, 0)); }
.sticky-go .btn:disabled { opacity: 1; background: var(--panel2); color: var(--muted); }

/* lists */
.job { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; transition: border-color .15s, transform .12s; }
.job:active { transform: scale(.99); }
.job:hover { border-color: var(--violet); }
.job .meta { flex: 1; min-width: 0; }
.job .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--panel2); color: var(--muted); }
.thumb.done { background: rgba(61, 220, 151, .14); color: var(--ok); }
.thumb.running, .thumb.queued { background: rgba(255, 198, 92, .12); color: var(--warn); }
.thumb.failed { background: rgba(255, 107, 129, .12); color: var(--bad); }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 99px; white-space: nowrap; background: var(--panel2); font-weight: 600; }
.pill.done { color: var(--ok); } .pill.running, .pill.queued { color: var(--warn); } .pill.failed { color: var(--bad); }
.empty { text-align: center; padding: 30px 16px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { text-decoration: none; color: var(--muted); font-size: 14px; }
.back::before { content: "‹ "; }
[dir=rtl] .back::before { content: "› "; }

.working { display: flex; gap: 14px; align-items: center; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--cyan); flex: none; box-shadow: 0 0 0 0 rgba(61, 214, 245, .6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 14px rgba(61, 214, 245, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 214, 245, 0); } }
.skel { height: 78px; border-radius: var(--r); margin: 12px 0; background: linear-gradient(90deg, var(--panel) 25%, var(--panel2) 50%, var(--panel) 75%);
  background-size: 200% 100%; animation: sk 1.3s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.vid video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 14px; display: block; }
.vid .cap { font-size: 14px; margin: 8px 0; font-weight: 600; }
.users { list-style: none; padding: 0; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.users .acts { display: flex; gap: 6px; }
.users .btn { min-height: 38px; padding: 6px 12px; font-size: 14px; }

@media (min-width: 720px) {
  body.has-tabs .tabs { display: none; }
  body.has-tabs main { padding-bottom: 60px; }
  #nav .wide { display: inline-flex; align-items: center; gap: 6px; }
  .desk { display: inline-flex !important; }
  .chip-btn span { display: inline; }
  .modes { grid-template-columns: 1fr 1fr; }
  .sticky-go { position: static; margin: 18px 0 0; padding: 0; background: none; }
  main { padding-top: 28px; }
  .videos { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* style: genres + customize */
.genres { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.genre { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: start; background: var(--panel); border: 2px solid var(--line);
  border-radius: 14px; padding: 12px; cursor: pointer; min-height: 72px; }
.genre b { font-size: 14px; line-height: 1.25; }
.genre.on { border-color: var(--violet); background: var(--panel2); box-shadow: 0 0 0 4px rgba(139, 108, 255, .16); }
.dots { display: flex; gap: 4px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }
.custom { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
.custom summary { cursor: pointer; font-weight: 800; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.custom summary::-webkit-details-marker { display: none; }
.custom summary::after { content: "+"; font-size: 22px; color: var(--muted); }
.custom[open] summary::after { content: "–"; }
.custom[open] { padding-bottom: 8px; }
.custom h3 { font-size: 15px; margin: 18px 0 8px; }
.custom .lbl { font-size: 13px; color: var(--muted); font-weight: 700; margin: 12px 0 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-height: 42px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--grad); color: #0f0c22; border-color: transparent; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); background: var(--c); cursor: pointer; padding: 0; margin: 0; position: relative; }
.sw.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--cyan); }
.sw.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); overflow: hidden; display: block; }
.sw.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.preview { height: 92px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: .28em; font-size: 26px; font-weight: 900;
  background: linear-gradient(160deg, #2a2240, #121022); color: var(--cap); text-shadow: 0 2px 0 rgba(0, 0, 0, .5); overflow: hidden; }
.preview span { display: inline-block; }
.preview.karaoke .cur, .preview.pop .cur, .preview.single .cur { color: var(--hl); transform: scale(1.08); }
.preview.box .cur { background: var(--hl); color: #0f0c22; padding: 0 .16em; border-radius: .2em; text-shadow: none; }
.preview.pop .next { opacity: 0; }
.preview.single { font-size: 36px; }
.preview.minimal { font-weight: 800; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0 0; font-weight: 700; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; }
.toggle input:checked + i { background: var(--violet); }
.toggle input:checked + i::after { inset-inline-start: 23px; }
.toggle input:focus-visible + i { outline: 2px solid var(--cyan); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--cyan); cursor: pointer; padding: 6px 0; font-size: 14px; text-decoration: underline; }
.sub-link { display: block; text-align: center; font-size: 13px; margin-top: 6px; color: var(--muted); }
@media (min-width: 720px) { .genres { grid-template-columns: repeat(4, 1fr); } }
.reject .fb { white-space: pre-wrap; background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; margin: 14px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--violet); }
.consent h1 { margin-top: 0; }
.legal-links { text-align: center; color: var(--muted); margin-top: 26px; }
.legal-links a { color: var(--muted); }
.btn.danger { background: rgba(255, 107, 129, .14); color: var(--bad); border: 1px solid rgba(255, 107, 129, .4); }
.quota { display: flex; align-items: center; gap: 10px; margin: -4px 0 8px; }
.quota .bar { flex: 0 0 90px; margin: 0; }
.email-link { max-width: 380px; margin: 8px auto 0; display: grid; gap: 10px; }
.email-link .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.email-link .or::before, .email-link .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
