:root {
  --bg: #070b16;
  --bg-2: #0a1120;
  --panel: #0f1729;
  --panel-2: #0c1424;
  --line: rgba(212, 175, 55, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);
  --gold: #d4af37;
  --gold-soft: #f0d488;
  --text: #f3eee2;
  --muted: #96a1b8;
  --muted-2: #6b778f;
  --ok: #5fbf8f;
  --err: #e27676;
  --radius: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Arial", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 500px at 85% -10%, rgba(212, 175, 55, 0.10), transparent 65%),
    radial-gradient(800px 600px at 0% 20%, rgba(60, 110, 200, 0.10), transparent 60%),
    radial-gradient(600px 500px at 50% 110%, rgba(120, 70, 200, 0.07), transparent 60%),
    linear-gradient(180deg, #080d19 0%, #060a13 100%);
}

.wrap {
  width: min(960px, 100% - 32px);
  margin-inline: auto;
}

/* ---------------- topbar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 11, 22, 0.74);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.mark { width: 40px; height: 40px; filter: drop-shadow(0 4px 14px rgba(212, 175, 55, 0.35)); }

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand .name {
  font-family: "Traditional Arabic", "Segoe UI", serif;
  font-size: 32px;
  color: var(--gold-soft);
  letter-spacing: 2px;
}

.brand .tag { font-size: 11.5px; color: var(--muted-2); letter-spacing: 0.3px; }

.credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(212, 175, 55, 0.07);
  color: var(--gold-soft);
  font-size: 13px;
  white-space: nowrap;
}

.userbox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.verify-banner {  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.07);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--gold-soft);
  font-size: 13px;
}.auth-link, .upgrade-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
}
.upgrade-link { color: var(--gold-soft); border-color: rgba(212, 175, 55, 0.35); }
button.auth-link { cursor: pointer; }

/* ---------------- hero ---------------- */

.hero { padding: 44px 0 26px; text-align: center; }

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(180deg, #fff7e2 10%, var(--gold-soft) 55%, #b8912a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(14px, 2.4vw, 16px);
  max-width: 560px;
  margin-inline: auto;
}

/* ---------------- card & form ---------------- */

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.form-card { padding: 26px; }

.field { margin-bottom: 22px; }

.label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold-soft);
  margin-bottom: 9px;
  letter-spacing: 0.2px;
}

.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.label-row .label { margin-bottom: 9px; }

.link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s, border-color 0.15s;
}
.link:hover { color: var(--gold-soft); border-color: var(--gold); }

input[type="text"], textarea {
  width: 100%;
  background: #0a1222;
  border: 1px solid #22304a;
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  padding: 13px 16px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

textarea {
  resize: vertical;
  min-height: 122px;
  line-height: 1.95;
  font-size: 19px;
}

input[type="text"]::placeholder, textarea::placeholder { color: #56617a; font-size: 15px; }

input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.65);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
  background: #0b1426;
}

.hint-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.hint { color: var(--muted-2); font-size: 12.5px; }
.hint.tiny { font-size: 11.5px; }
.count { color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.count.over { color: var(--err); }

/* chips */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid #24314a;
  background: #0b1322;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: rgba(212, 175, 55, 0.4); color: var(--text); }
.chip.active {
  background: rgba(212, 175, 55, 0.13);
  border-color: rgba(212, 175, 55, 0.8);
  color: var(--gold-soft);
  font-weight: 600;
}

/* themes */

.mini-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: #0b1322;
  border: 1px solid #22304a;
}

.label-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.upload-btn {
  border: 1px dashed rgba(212, 175, 55, 0.45);
  color: var(--gold-soft);
  background: rgba(212, 175, 55, 0.05);
  padding: 5px 12px;
}
.upload-btn:hover { background: rgba(212, 175, 55, 0.12); border-style: solid; }
.upload-btn:disabled { opacity: 0.6; cursor: wait; }

.mini-tab {
  border: none;
  background: none;
  color: var(--muted-2);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}
.mini-tab:hover { color: var(--text); }
.mini-tab.active { background: rgba(212, 175, 55, 0.16); color: var(--gold-soft); }

.themes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.theme { cursor: pointer; border: none; background: none; padding: 0; font-family: inherit; text-align: center; }

.theme-preview {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 15px;
  border: 2px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.theme-preview::before {
  content: "";
  position: absolute;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  top: 8%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.32;
  filter: blur(6px);
}

.theme-preview .mock-line {
  width: 52%;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.55;
  position: relative;
  z-index: 1;
}
.theme-preview .mock-line.short { width: 34%; opacity: 0.4; }
.theme-preview .mock-src {
  width: 24%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.28;
  margin-top: 4px;
}

.theme:hover .theme-preview { transform: translateY(-2px); border-color: rgba(212, 175, 55, 0.35); }

.theme.active .theme-preview {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), 0 10px 26px rgba(0, 0, 0, 0.45);
}

.theme-check {
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #0a0f1e;
  font-size: 12px;
  line-height: 20px;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 2;
}
.theme.active .theme-check { opacity: 1; transform: scale(1); }

.theme-name { display: block; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.theme.active .theme-name { color: var(--gold-soft); font-weight: 600; }

.photo-preview { background: #060a12; }
.photo-grid { max-height: 560px; overflow-y: auto; overscroll-behavior: contain; padding-inline-end: 4px; }
.photo-grid::-webkit-scrollbar { width: 8px; }
.photo-grid::-webkit-scrollbar-thumb { background: #24314a; border-radius: 999px; }
.photo-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.45));
  pointer-events: none;
}
.photo-empty { margin-top: 10px; line-height: 1.9; }
.photo-empty code {
  background: #0b1322;
  border: 1px solid #22304a;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11px;
  direction: ltr;
  display: inline-block;
}

/* durations + switch */

.split { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

.audio-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }

.quran-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.quran-row select,
.quran-row input[type="number"] {
  background: #0a1222;
  border: 1px solid #22304a;
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
}
.quran-row select { max-width: 280px; }
.quran-row input[type="number"] { width: 110px; }
.quran-row select:focus,
.quran-row input[type="number"]:focus { outline: none; border-color: rgba(212, 175, 55, 0.65); }
.quran-rec { margin-inline-start: 4px; }

.seg {
  display: inline-flex;
  background: #0b1322;
  border: 1px solid #22304a;
  border-radius: 13px;
  padding: 4px;
  gap: 4px;
}

.seg button {
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  padding: 7px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(212, 175, 55, 0.16); color: var(--gold-soft); font-weight: 600; }

.switch-wrap { display: flex; flex-direction: column; gap: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #1a2438;
  border: 1px solid #26344c;
  position: relative;
  transition: background 0.18s, border-color 0.18s;
  flex: none;
}
.knob {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #56617a;
  transition: transform 0.18s, background 0.18s;
}
.switch input:checked + .track { background: rgba(212, 175, 55, 0.25); border-color: rgba(212, 175, 55, 0.7); }
.switch input:checked + .track .knob { background: var(--gold-soft); transform: translateX(-18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2); }

/* submit */

.submit-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, filter 0.15s;
}

.btn.primary {
  min-width: 210px;
  padding: 14px 30px;
  font-size: 16.5px;
  color: #1c1503;
  background: linear-gradient(180deg, #f2d98f 0%, #d4af37 55%, #b8912a 100%);
  box-shadow: 0 10px 26px rgba(212, 175, 55, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(212, 175, 55, 0.3); }
.btn.primary:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: saturate(0.7); }

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(28, 21, 3, 0.25);
  border-top-color: #1c1503;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-error {
  margin-top: 14px;
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(226, 118, 118, 0.1);
  border: 1px solid rgba(226, 118, 118, 0.35);
  color: #f0a9a9;
  font-size: 13.5px;
}

/* ---------------- jobs ---------------- */

.jobs-section { padding: 38px 0 20px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 21px; font-weight: 700; color: var(--text); }
.muted { color: var(--muted-2); font-size: 13px; }

.jobs { display: flex; flex-direction: column; gap: 14px; }

.job {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #0d1527 0%, #0a1220 100%);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  transition: border-color 0.2s;
}
.job:hover { border-color: rgba(212, 175, 55, 0.22); }
.job.is-running { border-color: rgba(212, 175, 55, 0.3); }
.job.is-failed { border-color: rgba(226, 118, 118, 0.28); }

.job-media {
  flex: 0 0 168px;
  width: 168px;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: #04070e;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

.job-media video { width: 100%; height: 100%; object-fit: cover; display: block; }

.poster {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(circle at 50% 30%, var(--accent, #d4af37) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg1, #0c142a), var(--bg2, #04070e));
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  letter-spacing: 1px;
}
.poster .poster-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--accent, #d4af37);
  opacity: 0.7;
}
.poster .mock-line { width: 46%; height: 3px; border-radius: 3px; background: var(--accent, #d4af37); opacity: 0.5; }
.poster .mock-line.short { width: 30%; opacity: 0.32; }

.poster.poster-photo {
  background-size: cover;
  background-position: center;
  opacity: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.job-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }

.job-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.queued { color: #c9b98a; background: rgba(212, 175, 55, 0.08); border-color: rgba(212, 175, 55, 0.22); }
.pill.running { color: var(--gold-soft); background: rgba(212, 175, 55, 0.12); border-color: rgba(212, 175, 55, 0.35); }
.pill.running .dot { animation: pulse 1.2s ease-in-out infinite; }
.pill.done { color: var(--ok); background: rgba(95, 191, 143, 0.09); border-color: rgba(95, 191, 143, 0.28); }
.pill.failed { color: var(--err); background: rgba(226, 118, 118, 0.1); border-color: rgba(226, 118, 118, 0.3); }
@keyframes pulse { 50% { opacity: 0.25; } }

.job-meta { font-size: 12px; color: var(--muted-2); }

.job-text {
  font-size: 16px;
  color: #e8e2d4;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-source { font-size: 12px; color: var(--muted-2); }

.progress-wrap { margin-top: 2px; }
.progress {
  height: 7px;
  border-radius: 999px;
  background: #17223a;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b8912a, #f0d488);
  transition: width 0.6s ease;
  width: 0%;
}
.progress-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.progress-meta .stage { display: inline-flex; align-items: center; gap: 7px; }

.job-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }

.btn.small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 10px;
  text-decoration: none;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold-soft);
}
.btn.small:hover { background: rgba(212, 175, 55, 0.2); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--muted);
}
.btn.ghost:hover { border-color: rgba(212, 175, 55, 0.35); color: var(--text); }

.job-error { font-size: 12.5px; color: #f0a9a9; }

/* empty */

.empty {
  border: 1px dashed rgba(212, 175, 55, 0.22);
  border-radius: 18px;
  padding: 42px 20px;
  text-align: center;
  color: var(--muted-2);
  background: rgba(212, 175, 55, 0.02);
}
.empty-icon { font-size: 26px; color: rgba(212, 175, 55, 0.5); margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 15px; }
.empty span { font-size: 12.5px; }

/* ---------------- footer ---------------- */

.footer {
  margin-top: 40px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}
.dot-sep { margin: 0 8px; opacity: 0.5; }

/* ---------------- responsive ---------------- */

@media (max-width: 720px) {
  .form-card { padding: 18px; }
  .themes { grid-template-columns: repeat(2, 1fr); }
  .job { flex-direction: column; }
  .job-media { width: 100%; flex-basis: auto; max-height: 420px; }
  .job-media video { object-fit: contain; }
  .brand .tag { display: none; }
  .split { gap: 16px; }
  .btn.primary { width: 100%; }
  .submit-row { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
