:root {
  --bg: #0B0B1A;
  --bg-2: #11112A;
  --card: #17172F;
  --card-2: #1E1E3A;
  --line: rgba(167, 139, 250, .16);
  --line-2: rgba(255, 255, 255, .08);
  --fg: #F4F2FF;
  --muted: #A5A3C2;
  --primary: #8B5CF6;
  --primary-2: #A78BFA;
  --on-primary: #FFFFFF;
  --accent: #FB923C;
  --ok: #34D399;
  --danger: #F87171;
  --radius: 18px;
  --radius-sm: 12px;
  --side-w: 264px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .6);
  --f-head: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 16px/1.65 var(--f-body);
  overflow-x: hidden;
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, .18), transparent 60%),
    radial-gradient(700px 400px at 10% 0%, rgba(251, 146, 60, .07), transparent 60%);
  background-repeat: no-repeat; background-attachment: fixed;
}
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.25; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--primary-2); }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; inset-inline-start: 16px; top: -60px; background: var(--primary); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 80; }
.skip:focus { top: 12px; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 26px; height: 26px; }
.ic.xl { width: 34px; height: 34px; }
[dir="rtl"] .ic.flip { transform: scaleX(-1); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .15s, opacity .2s;
  background: transparent; color: var(--fg); position: relative;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #6D28D9); color: var(--on-primary); box-shadow: 0 10px 30px -10px rgba(139, 92, 246, .8); }
.btn.primary:hover { background: linear-gradient(135deg, #9D74F8, #7C3AED); }
.btn.ghost { border-color: var(--line); background: rgba(255, 255, 255, .03); }
.btn.ghost:hover { border-color: var(--primary-2); background: rgba(139, 92, 246, .1); }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn.lg { min-height: 54px; padding: 14px 26px; font-size: 17px; }
.btn.icon { padding: 0; width: 44px; min-width: 44px; border-radius: 50%; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dot { position: absolute; top: 2px; inset-inline-end: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg-2); }
.dot.ok { background: var(--ok); }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; gap: 10px; padding: 18px 14px;
  background: rgba(17, 17, 42, .82); border-inline-end: 1px solid var(--line-2); backdrop-filter: blur(16px); z-index: 40;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); padding: 4px 8px 10px; }
.brand-name { font-family: "Alexandria", sans-serif; font-weight: 800; font-size: 21px; letter-spacing: -.02em; direction: ltr; display: inline-flex; align-items: baseline; gap: 6px; }
.brand-name small { font-size: 12px; font-weight: 600; color: var(--primary-2); letter-spacing: .04em; text-transform: uppercase; }
.logo { display: inline-flex; align-items: center; gap: 3px; height: 32px; width: 36px; justify-content: center; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); padding: 0 6px; flex: none; }
.logo span { width: 3px; border-radius: 3px; background: #fff; animation: eq 1.2s ease-in-out infinite; }
.logo span:nth-child(1) { height: 8px; animation-delay: -.2s; }
.logo span:nth-child(2) { height: 16px; animation-delay: -.5s; }
.logo span:nth-child(3) { height: 12px; animation-delay: -.1s; }
.logo span:nth-child(4) { height: 18px; animation-delay: -.7s; }
.logo span:nth-child(5) { height: 8px; animation-delay: -.3s; }
@keyframes eq { 50% { transform: scaleY(.45); } }
.menu { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin-inline: -4px; padding-inline: 4px; }
.menu-h { font-size: 12px; font-weight: 600; color: var(--muted); opacity: .75; padding: 14px 12px 4px; letter-spacing: .02em; }
.menu a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; transition: background .15s, color .15s; }
.menu a:hover { color: var(--fg); background: rgba(255, 255, 255, .05); }
.menu a.on { color: var(--fg); background: linear-gradient(90deg, rgba(139, 92, 246, .22), rgba(139, 92, 246, .06)); box-shadow: inset 0 0 0 1px var(--line); }
[dir="rtl"] .menu a.on { background: linear-gradient(270deg, rgba(139, 92, 246, .22), rgba(139, 92, 246, .06)); }
.menu a.on .ic { color: var(--primary-2); }
.side-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.side-actions { display: flex; gap: 8px; }
.side-actions .btn:first-child { flex: 1; }
.credits { padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line-2); font-size: 13px; }
.credits-t { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 6px; }
.credits-t strong { color: var(--fg); font-variant-numeric: tabular-nums; direction: ltr; }
.scrim { position: fixed; inset: 0; background: rgba(5, 5, 15, .6); z-index: 35; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mtop { display: none; }
main { flex: 1; width: min(1180px, 100%); margin-inline: auto; padding: 28px clamp(16px, 3vw, 40px) 40px; outline: none; }
.foot { padding: 20px clamp(16px, 3vw, 40px) 28px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 13.5px; text-align: center; }

.notice { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); background: rgba(251, 146, 60, .08); border: 1px solid rgba(251, 146, 60, .3); margin-bottom: 22px; }
.notice > .ic { color: var(--accent); width: 28px; height: 28px; }
.notice div { flex: 1; }
.notice p { color: var(--muted); font-size: 14px; }

/* Home */
.home-hero { text-align: center; padding: 26px 0 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--primary-2); background: rgba(139, 92, 246, .08); font-size: 14px; font-weight: 500; }
.eyebrow .ic { width: 16px; height: 16px; }
.home-hero h1 { font-size: clamp(32px, 5.5vw, 58px); font-weight: 800; margin: 18px auto 14px; }
.home-hero h1 em, .how-n { font-style: normal; background: linear-gradient(90deg, var(--primary-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: clamp(15px, 2vw, 18px); max-width: 62ch; margin-inline: auto; }
.wave-hero { display: flex; align-items: center; justify-content: center; gap: 4px; height: 70px; margin: 26px auto 6px; max-width: 640px; overflow: hidden; }
.wave-hero i { width: 4px; border-radius: 4px; background: linear-gradient(var(--primary-2), var(--primary)); opacity: .75; animation: eq 1.6s ease-in-out infinite; }
.wave-hero i:nth-child(3n) { background: linear-gradient(var(--accent), #F97316); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 26px; }
.tool { --c: 262; position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 20px; text-decoration: none; color: var(--fg); background: linear-gradient(160deg, hsl(var(--c) 60% 50% / .14), var(--card) 55%); border: 1px solid var(--line-2); transition: transform .2s, border-color .2s; overflow: hidden; }
.tool:hover { transform: translateY(-3px); border-color: hsl(var(--c) 80% 70% / .45); }
.tool strong { font-family: var(--f-head); font-size: 17px; margin-top: 6px; }
.tool small { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.tool-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: hsl(var(--c) 70% 60% / .18); color: hsl(var(--c) 90% 78%); }
.tool-ic .ic { width: 24px; height: 24px; }
.t-violet { --c: 262; } .t-orange { --c: 24; } .t-pink { --c: 330; } .t-blue { --c: 215; } .t-green { --c: 155; } .t-amber { --c: 42; } .t-cyan { --c: 188; }

.block { margin-top: 34px; }
.block-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.block-h h2 { font-size: 20px; }
.block-h a { font-weight: 600; text-decoration: none; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tool views */
.view-h { margin-bottom: 22px; }
.view-h h1 { font-size: clamp(26px, 3.6vw, 34px); font-weight: 700; }
.view-h p { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: clamp(16px, 2.4vw, 22px); }
.pane.narrow { max-width: 760px; }
.settings-pane { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 20px; }
.editor { display: flex; flex-direction: column; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line-2); overflow: hidden; }
.editor:focus-within { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
.editor textarea { border: 0; background: transparent; resize: vertical; min-height: 280px; padding: 18px; font-size: 18px; line-height: 1.8; outline: none; }
.editor.small textarea { min-height: 150px; font-size: 17px; }
.editor-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; direction: ltr; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--muted); border-radius: 999px; padding: 6px 12px; min-height: 36px; font-size: 13.5px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; text-align: start; }
.chip:hover { color: var(--fg); border-color: var(--primary-2); }
.chip.on { background: rgba(139, 92, 246, .2); color: var(--fg); border-color: var(--primary); }
.chips.filter { margin-bottom: 16px; }
#dsSamples { margin: -4px 0 14px; }
.go-row { display: flex; justify-content: flex-end; margin-top: 16px; }
.slider { padding: 8px 0 4px; }
.slider label { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.slider output { color: var(--primary-2); font-variant-numeric: tabular-nums; direction: ltr; }
.slider .ends { direction: ltr; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 2px; }
/* Sliders run left→right in both languages; the fill is drawn from --p (set in JS). */
input[type="range"] { direction: ltr; -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 10px 0; border-radius: 6px; cursor: pointer;
  background: linear-gradient(to right, var(--primary-2) var(--p, 50%), rgba(255, 255, 255, .12) var(--p, 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); transition: transform .15s; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 6px; }
input[type="range"]:disabled { opacity: .35; cursor: not-allowed; }

/* Voice button */
.vbtn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; text-align: start; transition: border-color .15s; }
.vbtn:hover { border-color: var(--primary-2); }
.vbtn > .ic { color: var(--muted); }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-family: "Alexandria"; color: #fff; background: var(--card-2); }
.vi { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.vi strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vi small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-tag { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(52, 211, 153, .15); color: var(--ok); margin-inline-start: 4px; vertical-align: middle; }

/* Generated audio rows */
.gens { display: flex; flex-direction: column; gap: 10px; }
.gen { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line-2); transition: border-color .2s; }
.gen.playing { border-color: var(--primary); }
.gen .play { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--primary), #6D28D9); box-shadow: 0 8px 20px -8px rgba(139, 92, 246, .9); }
.gen .play .ic { width: 20px; height: 20px; }
.gen-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gen-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gen-top strong { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-tool { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 12px; color: var(--primary-2); background: rgba(139, 92, 246, .14); padding: 2px 8px; border-radius: 999px; }
.gen-tool .ic { width: 13px; height: 13px; }
.wf { display: flex; align-items: center; gap: 2px; height: 34px; cursor: pointer; }
.wf i { flex: 1; min-width: 2px; border-radius: 2px; background: rgba(167, 139, 250, .3); transition: background .1s; }
.wf i.on { background: var(--primary-2); }
.gen-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12.5px; }
.gen-meta .time { font-variant-numeric: tabular-nums; direction: ltr; }
.gen-act { display: flex; gap: 4px; }
.empty { color: var(--muted); }
.empty.center { text-align: center; padding: 30px 0; }

/* Audio input */
.audio-in .seg { margin-bottom: 12px; }
.rec-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; border-radius: var(--radius); border: 2px dashed rgba(167, 139, 250, .35); background: rgba(139, 92, 246, .04); }
.rec-box small { color: var(--muted); }
.rec-box .timer { position: static; transform: none; font-size: 20px; }
.recbig { width: 72px; height: 72px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--primary), #6D28D9); }
.recbig .ic { width: 30px; height: 30px; }
.recbig.live, #recBtn.live { background: linear-gradient(135deg, #EF4444, #B91C1C); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); } }
.fc-ic { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: rgba(139, 92, 246, .15); color: var(--primary-2); flex: none; }

/* Transcript */
.transcript { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; max-height: 560px; overflow: auto; }
.stt-meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.line { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.line:last-child { border-bottom: 0; }
.line .ts { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; direction: ltr; padding-top: 4px; grid-row: span 2; }
.line .spk { color: var(--primary-2); font-size: 13px; font-weight: 600; }
.line p { font-size: 16.5px; line-height: 1.8; grid-column: 2; }

/* Voice design previews */
.ta { width: 100%; min-height: 110px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-2); resize: vertical; font-size: 16px; line-height: 1.7; }
.ta.short { min-height: 80px; }
.ta:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
.previews { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.preview { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line-2); flex-wrap: wrap; }
.pv-mid { display: flex; flex-direction: column; min-width: 80px; }
.pv-mid small { color: var(--muted); }
.preview input { flex: 1; min-width: 140px; }

/* Forms */
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); margin-bottom: 14px; max-width: 100%; overflow-x: auto; }
.seg button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 16px; min-height: 40px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--card-2); color: var(--fg); box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.seg .ic { width: 18px; height: 18px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 36px 16px; border: 2px dashed rgba(167, 139, 250, .35); border-radius: var(--radius); cursor: pointer; background: rgba(139, 92, 246, .04); transition: border-color .2s, background .2s; }
.drop:hover, .drop.over { border-color: var(--primary-2); background: rgba(139, 92, 246, .1); }
.drop .ic { color: var(--primary-2); margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop.small { padding: 26px 16px; }
.filecard { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line-2); }
.filecard video { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #000; flex: none; }
.fc-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fc-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-meta span { color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: 14px; }
.field small, .hint { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="url"], input[type="password"], input[type="number"], input[type="search"], select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); font-size: 16px;
}
input:focus, select:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A5A3C2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-size: 18px; background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 42px; cursor: pointer; }
[dir="ltr"] select { background-position: right 14px center; }
select option { background: var(--bg-2); color: var(--fg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row2 { display: flex; gap: 8px; }
.adv { margin-top: 4px; }
.adv summary { cursor: pointer; color: var(--primary-2); font-weight: 600; padding: 8px 0; min-height: 44px; display: flex; align-items: center; }
.adv[open] summary { margin-bottom: 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin-top: 3px; }
.err { color: var(--danger); margin-top: 12px; font-size: 14px; }
.ok { color: var(--ok); margin-top: 12px; font-size: 14px; }
.progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.bar { flex: 1; height: 8px; border-radius: 8px; background: var(--bg-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 8px; transition: width .3s; }
.bar.indet i { width: 35% !important; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
[dir="rtl"] .bar.indet i { animation-name: indet-rtl; }
@keyframes indet-rtl { from { transform: translateX(120%); } to { transform: translateX(-320%); } }
.progress span { color: var(--muted); font-size: 14px; min-width: 50px; }

/* Dubbing */
.studio { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: clamp(18px, 3vw, 30px); }
.step { display: flex; gap: 18px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px dashed var(--line-2); }
.step-n { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: "Alexandria"; font-weight: 700; background: rgba(139, 92, 246, .15); color: var(--primary-2); border: 1px solid var(--line); }
.step-body { flex: 1; min-width: 0; }
.step h3 { font-size: 19px; margin: 4px 0 14px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border-radius: var(--radius); border: 1.5px solid var(--line-2); background: var(--bg-2); cursor: pointer; transition: border-color .2s, background .2s; }
.mode-card .ic { color: var(--primary-2); margin-bottom: 4px; }
.mode-card small { color: var(--muted); font-size: 13px; line-height: 1.5; }
.mode-card:hover { border-color: var(--line); }
.mode input:checked + .mode-card { border-color: var(--primary); background: linear-gradient(160deg, rgba(139, 92, 246, .18), rgba(139, 92, 246, .04)); }
.mode input:focus-visible + .mode-card { outline: 2px solid var(--primary-2); outline-offset: 3px; }
.dub-voice { margin-top: 16px; max-width: 420px; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.job { background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.job-media { aspect-ratio: 16/9; background: #05050d; display: grid; place-items: center; }
.job-media video { width: 100%; height: 100%; }
.job-media audio { width: calc(100% - 24px); }
.job-media .stage { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); text-align: center; padding: 16px; width: 100%; }
.job-media .stage .bar { width: 70%; flex: none; }
.mini-wave { display: flex; gap: 3px; height: 30px; align-items: center; }
.mini-wave i { width: 4px; height: 100%; border-radius: 3px; background: var(--primary-2); animation: eq 1s ease-in-out infinite; }
.mini-wave i:nth-child(2) { animation-delay: -.2s; } .mini-wave i:nth-child(3) { animation-delay: -.4s; } .mini-wave i:nth-child(4) { animation-delay: -.6s; } .mini-wave i:nth-child(5) { animation-delay: -.8s; }
.job-b { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.job-t { display: flex; align-items: center; gap: 10px; }
.job-t strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(139, 92, 246, .15); color: var(--primary-2); white-space: nowrap; }
.tag.done { background: rgba(52, 211, 153, .14); color: var(--ok); }
.tag.failed { background: rgba(248, 113, 113, .14); color: var(--danger); }
.job-meta { color: var(--muted); font-size: 13.5px; display: flex; gap: 6px 14px; flex-wrap: wrap; }
.job-a { display: flex; gap: 8px; flex-wrap: wrap; }
.job-err { color: var(--danger); font-size: 13.5px; }

/* Voices view */
.voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: clamp(16px, 2.6vw, 24px); }
.card h3 { font-size: 19px; margin-bottom: 12px; }
.script-l { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.script { margin: 0 0 14px; padding: 16px 18px; border-radius: 14px; background: var(--bg-2); border-inline-start: 3px solid var(--primary); font-size: 17px; line-height: 1.9; max-height: 210px; overflow: auto; }
.meter { position: relative; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line-2); overflow: hidden; margin-bottom: 12px; }
.meter canvas { width: 100%; height: 64px; display: block; }
.timer { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); font-family: "Alexandria"; font-weight: 600; font-variant-numeric: tabular-nums; background: rgba(11, 11, 26, .8); padding: 2px 10px; border-radius: 8px; direction: ltr; }
.rec-actions { display: flex; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.rec .field { margin-top: 18px; }
.consent { margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.samples { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.samples li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--bg-2); font-size: 14px; }
.tips { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.tips h4 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 8px; }
.tips h4 .ic { color: var(--ok); }
.tips ul { margin: 0; padding-inline-start: 20px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.lib-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.lib-h .seg { margin: 0; }
.lib-h .search { flex: 1; min-width: 160px; }
.vrows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; max-height: 640px; overflow: auto; }
.vrows li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line-2); }
.vrows li.empty, .vrows li.err { background: none; border: 0; }
.vrows li.skel, .vlist .skel { height: 60px; border-radius: 14px; background: linear-gradient(90deg, var(--bg-2), var(--card-2), var(--bg-2)); background-size: 200% 100%; animation: sh 1.4s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* Modals */
.modal { border: 0; padding: 0; background: transparent; color: var(--fg); width: min(520px, 100% - 32px); max-height: calc(100vh - 32px); }
.modal.wide { width: min(760px, 100% - 32px); }
.modal::backdrop { background: rgba(5, 5, 15, .7); backdrop-filter: blur(4px); }
.modal-in { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); }
.modal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-h h2 { font-size: 21px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.acct { padding: 12px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14px; color: var(--muted); }
.acct strong { color: var(--fg); }
.vlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-height: min(60vh, 520px); overflow: auto; padding: 2px; }
.voice { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--bg-2); cursor: pointer; text-align: start; }
.voice:hover { border-color: var(--line); }
.voice[aria-selected="true"] { border-color: var(--primary); background: rgba(139, 92, 246, .12); }
.voice .pv { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); z-index: 90; max-width: calc(100% - 32px); font-weight: 500; }

/* Responsive */
@media (max-width: 1080px) {
  .split { grid-template-columns: 1fr; }
  .settings-pane { position: static; }
  .voice-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow); }
  [dir="rtl"] .side { transform: translateX(105%); }
  .side.open { transform: none !important; }
  .mtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 8px 12px; background: rgba(11, 11, 26, .85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-2); }
  .mtop .brand { padding: 0; }
  main { padding-top: 18px; }
  .modes { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .step { gap: 12px; }
  .step-n { width: 30px; height: 30px; font-size: 14px; }
  .jobs { grid-template-columns: 1fr; }
  .submit-row .btn, .go-row .btn { width: 100%; }
  .filecard video { width: 84px; }
  .tools { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tool { padding: 14px; }
  .tool small { display: none; }
  .tool-ic { width: 40px; height: 40px; }
  .gen { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .gen-mid { flex-basis: calc(100% - 62px); }
  .gen-act { margin-inline-start: auto; }
  .editor textarea { min-height: 200px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
