:root{
  --bg:#0b0d14; --bg2:#111421; --card:rgba(22,26,42,.72); --line:rgba(255,255,255,.08);
  --text:#eef0f7; --muted:#9aa1b8;
  --teal:#2dd4bf; --violet:#8b5cf6; --gold:#f5c451; --danger:#f87171;
  --r:18px;
  --font:'Vazirmatn','Noto Kufi Arabic',system-ui,sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{background:var(--bg);color:var(--text);font-family:var(--font);min-height:100%}
body{overflow-x:hidden;line-height:1.7}
button,input,select{font-family:inherit;font-size:inherit;color:inherit}
.hidden{display:none!important}
.muted{color:var(--muted)}

.glow{position:fixed;width:520px;height:520px;border-radius:50%;filter:blur(120px);opacity:.25;pointer-events:none;z-index:0}
.g1{background:var(--violet);top:-200px;right:-160px}
.g2{background:var(--teal);bottom:-240px;left:-180px;opacity:.18}

.top{position:relative;z-index:2;display:flex;align-items:center;justify-content:space-between;padding:18px 24px;max-width:1360px;margin:auto}
.brand{display:flex;align-items:center;gap:12px}
.logo{width:46px;height:46px;border-radius:14px;display:grid;place-items:center;font:800 26px 'Noto Kufi Arabic';
  background:linear-gradient(135deg,var(--teal),var(--violet));color:#0b0d14;box-shadow:0 8px 30px rgba(139,92,246,.35)}
.brand h1{font:800 22px 'Noto Kufi Arabic';letter-spacing:0}
.brand small{color:var(--muted);font-size:13px}

.wrap{position:relative;z-index:1;max-width:1360px;margin:0 auto;padding:8px 24px 40px}
.wrap.narrow{max-width:440px;padding-top:60px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}

.btn{border:1px solid var(--line);background:rgba(255,255,255,.05);padding:10px 18px;border-radius:12px;cursor:pointer;font-weight:600;
  display:inline-flex;align-items:center;justify-content:center;gap:8px;transition:.2s}
.btn:not(.primary):not(.gold):hover:not(:disabled){background:rgba(255,255,255,.1)}
.btn:disabled{opacity:.4;cursor:not-allowed}
.btn.primary{background:linear-gradient(135deg,var(--teal),var(--violet));border:0;color:#0b0d14;font-weight:800}
.btn.primary:hover:not(:disabled){filter:brightness(1.1);transform:translateY(-1px)}
.btn.gold{background:linear-gradient(135deg,#f5c451,#e09a2b);border:0;color:#1a1204;font-weight:800}
.btn.big{width:100%;padding:14px;font-size:17px;border-radius:14px}
.ghost{background:transparent;border:1px solid var(--line);border-radius:10px;cursor:pointer;color:var(--text);text-decoration:none}
.ghost:hover{border-color:var(--teal);color:var(--teal)}
.sm{padding:6px 12px;font-size:13px}

/* login */
.login{padding:30px;display:flex;flex-direction:column;gap:14px}
.login h2{font-family:'Noto Kufi Arabic'}
.login input{background:var(--bg2);border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.err{color:var(--danger);font-size:14px}

/* drop */
.drop{padding:70px 24px;text-align:center;border-style:dashed;border-width:2px;border-color:rgba(45,212,191,.3);cursor:pointer;transition:.25s;margin-top:20px}
.drop.over{border-color:var(--teal);background:rgba(45,212,191,.06)}
.drop-inner{display:flex;flex-direction:column;align-items:center;gap:12px}
.drop-icon{width:86px;height:86px;border-radius:50%;display:grid;place-items:center;color:var(--teal);
  background:rgba(45,212,191,.1);border:1px solid rgba(45,212,191,.25)}
.drop h2{font:800 26px 'Noto Kufi Arabic'}
.hint{font-size:13px;color:var(--muted);margin-top:6px}

/* workspace */
.workspace{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:20px;align-items:start}
.player-col{display:flex;flex-direction:column;gap:16px}
.player{overflow:hidden}
.stage{position:relative;background:#000;aspect-ratio:16/9;display:flex;align-items:center;justify-content:center}
.stage video{width:100%;height:100%;object-fit:contain;display:block}
.stage video::cue{opacity:0}
.sub-overlay{position:absolute;left:4%;right:4%;bottom:14%;text-align:center;pointer-events:none;direction:rtl}
.sub-overlay span{display:inline;font-weight:600;line-height:1.55;padding:.12em .5em;border-radius:6px;
  -webkit-box-decoration-break:clone;box-decoration-break:clone;white-space:pre-wrap}
.sub-overlay span:empty{display:none}
.sub-overlay.box span{background:rgba(0,0,0,.72)}
.sub-overlay.shadow span{text-shadow:0 2px 6px #000,0 0 3px #000}
.sub-overlay.outline span{-webkit-text-stroke:3px #000;paint-order:stroke fill}
.file-meta{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 14px;font-size:14px;color:var(--muted)}
.file-meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:ltr;text-align:right}

.controls,.style-card{padding:18px;display:flex;flex-direction:column;gap:14px}
.style-card h3{font-size:16px}
.row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted)}
select{background:var(--bg2);border:1px solid var(--line);border-radius:10px;padding:9px 10px}
input[type=range]{accent-color:var(--teal)}
input[type=color]{width:100%;height:38px;border:1px solid var(--line);border-radius:10px;background:var(--bg2);padding:3px}

.progress{display:flex;flex-direction:column;gap:10px}
.steps{display:flex;gap:8px;flex-wrap:wrap}
.step{flex:1;min-width:110px;font-size:13px;padding:8px 10px;border-radius:10px;background:rgba(255,255,255,.04);border:1px solid var(--line);display:flex;align-items:center;gap:8px;color:var(--muted)}
.step i{width:10px;height:10px;border-radius:50%;background:#444a60;flex:none}
.step.on{color:var(--text);border-color:rgba(45,212,191,.4)}
.step.on i{background:var(--teal);box-shadow:0 0 0 4px rgba(45,212,191,.2);animation:pulse 1.2s infinite}
.step.done i{background:var(--teal);animation:none}
.step.done{color:var(--teal)}
@keyframes pulse{50%{box-shadow:0 0 0 8px rgba(45,212,191,0)}}
.bar{height:8px;border-radius:99px;background:rgba(255,255,255,.07);overflow:hidden}
.bar b{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--violet),var(--teal));transition:width .3s;border-radius:99px;margin-right:0}
.pmsg{font-size:13px;color:var(--muted);min-height:1.5em}

/* editor */
.editor-col{display:flex;flex-direction:column;max-height:calc(100vh - 110px);position:sticky;top:16px;overflow:hidden}
.ed-head{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line);gap:8px}
.ed-head h3{font-size:16px}
.count{font-size:12px;color:var(--teal);background:rgba(45,212,191,.12);padding:2px 8px;border-radius:99px;margin-inline-start:6px}
.ed-actions{display:flex;gap:6px}
.lines{flex:1;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:8px;min-height:240px}
.empty{margin:auto;text-align:center;display:flex;flex-direction:column;gap:8px;align-items:center;padding:30px 10px}
.filebtn{display:inline-block;margin-top:6px}

.ln{border:1px solid var(--line);border-radius:14px;padding:10px 12px;background:rgba(255,255,255,.02);transition:.15s}
.ln.active{border-color:var(--teal);background:rgba(45,212,191,.07)}
.ln-top{display:flex;align-items:center;gap:6px;margin-bottom:6px;direction:ltr}
.ln-num{font-size:11px;color:var(--muted);min-width:24px;text-align:center}
.tc{width:92px;background:var(--bg2);border:1px solid var(--line);border-radius:8px;padding:3px 6px;font-size:12px;font-family:ui-monospace,monospace;direction:ltr;text-align:center}
.tc.bad{border-color:var(--danger)}
.ln-tools{margin-left:auto;display:flex;gap:4px}
.ic{width:28px;height:28px;border-radius:8px;border:1px solid transparent;background:transparent;cursor:pointer;color:var(--muted);display:grid;place-items:center}
.ic:hover{border-color:var(--line);color:var(--text)}
.ic.del:hover{color:var(--danger)}
.ku{width:100%;resize:none;background:transparent;border:0;outline:0;font-size:16px;line-height:1.6;direction:rtl;color:var(--text);font-family:var(--font);overflow:hidden}
.ku:focus{background:rgba(255,255,255,.03);border-radius:6px}
.orig{font-size:12.5px;color:var(--muted);direction:auto;unicode-bidi:plaintext;margin-top:4px;border-top:1px dashed var(--line);padding-top:4px}
.lines.no-orig .orig{display:none}

.exports{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px;border-top:1px solid var(--line)}
.exports .gold{grid-column:1/-1}
.burn-status{padding:0 12px 12px;display:flex;flex-direction:column;gap:8px}

.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%,120px);background:#1b2035;border:1px solid var(--line);
  padding:12px 18px;border-radius:12px;z-index:50;transition:.3s;max-width:90vw;box-shadow:0 10px 40px rgba(0,0,0,.4)}
.toast.show{transform:translate(-50%,0)}
.toast.bad{border-color:rgba(248,113,113,.5)}

.foot{text-align:center;color:#555c75;font-size:12px;padding:20px}

@media (max-width:980px){
  .workspace{grid-template-columns:1fr}
  .editor-col{position:static;max-height:none}
  .lines{max-height:60vh}
}
@media (max-width:520px){
  .wrap{padding:6px 14px 30px}
  .top{padding:14px 16px}
  .row{grid-template-columns:1fr}
  .drop{padding:44px 16px}
  .drop h2{font-size:21px}
}

/* کلیل */
.top-actions{display:flex;gap:8px;align-items:center}
.keybtn{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;border-radius:99px;cursor:pointer;font-weight:600;font-size:13px;
  background:rgba(245,196,81,.12);border:1px solid rgba(245,196,81,.45);color:var(--gold)}
.keybtn.has{background:rgba(45,212,191,.1);border-color:rgba(45,212,191,.4);color:var(--teal)}
.keybtn:hover{filter:brightness(1.15)}
.modal{position:fixed;inset:0;z-index:60;background:rgba(5,6,12,.7);backdrop-filter:blur(6px);display:grid;place-items:center;padding:16px}
.modal-box{width:100%;max-width:460px;padding:20px;display:flex;flex-direction:column;gap:12px;background:#151a2b}
.modal-head{display:flex;justify-content:space-between;align-items:center}
.modal-head h3{font:800 19px 'Noto Kufi Arabic'}
.small{font-size:13px;line-height:1.8}
.small a{color:var(--teal)}
.keyrow{display:flex;gap:6px}
.keyrow input{flex:1;min-width:0;background:var(--bg2);border:1px solid var(--line);border-radius:12px;padding:11px 12px;font-family:ui-monospace,monospace;font-size:14px;text-align:left}
.keyrow input:focus{outline:none;border-color:var(--teal)}
.keyrow .ic{width:44px;height:auto;border:1px solid var(--line)}
.kmsg{font-size:13px;min-height:1.4em;color:var(--muted);word-break:break-word}
.kmsg.bad{color:var(--danger)}
.kmsg.good{color:var(--teal)}
.modal-actions{display:grid;grid-template-columns:1.4fr 1fr;gap:8px}
.btn.danger{color:var(--danger);border-color:rgba(248,113,113,.35)}
/* بەشی ڕەتکراو */
.ln.blocked{border-style:dashed;border-color:rgba(245,196,81,.55);background:rgba(245,196,81,.05)}
.ln.blocked .ku::placeholder{color:#c9a54e}


/* ===== ڕێڕەوی هەنگاوەکان ===== */
.stepper{list-style:none;display:flex;gap:6px;margin:4px 0 18px;padding:6px;border-radius:16px;background:rgba(255,255,255,.03);border:1px solid var(--line)}
.stepper li{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;padding:9px 6px;border-radius:11px;color:var(--muted);font-size:14px;cursor:default;transition:.25s;white-space:nowrap}
.stepper li b{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font-size:12px;background:rgba(255,255,255,.07);flex:none;transition:.25s}
.stepper li.on{background:linear-gradient(135deg,rgba(45,212,191,.16),rgba(139,92,246,.16));color:var(--text);font-weight:700}
.stepper li.on b{background:linear-gradient(135deg,var(--teal),var(--violet));color:#0b0d14}
.stepper li.done{color:var(--teal)}
.stepper li.done b{background:rgba(45,212,191,.18);color:var(--teal)}
.stepper li.done b::after{content:''}
.stepper li[data-k="key"],.stepper li[data-k="video"]{cursor:pointer}
.stepper li[data-k="key"]:hover,.stepper li[data-k="video"]:hover{background:rgba(255,255,255,.05)}

/* ===== یەکەم جار ===== */
.onboard{max-width:640px;margin:10px auto 0;padding:28px;display:flex;flex-direction:column;gap:16px}
.ob-head{display:flex;gap:16px;align-items:flex-start}
.ob-icon{width:58px;height:58px;border-radius:16px;flex:none;display:grid;place-items:center;color:var(--gold);background:rgba(245,196,81,.1);border:1px solid rgba(245,196,81,.3)}
.ob-head h2{font:800 22px 'Noto Kufi Arabic';margin-bottom:2px}
.howto{counter-reset:h;list-style:none;display:flex;flex-direction:column;gap:8px;padding:14px;border-radius:14px;background:rgba(255,255,255,.03);border:1px solid var(--line)}
.howto li{counter-increment:h;display:flex;gap:10px;align-items:baseline;font-size:14.5px}
.howto li::before{content:counter(h, arabic-indic);width:24px;height:24px;flex:none;border-radius:50%;display:grid;place-items:center;font-size:12px;font-weight:800;background:rgba(45,212,191,.15);color:var(--teal)}
.howto a{color:var(--teal);font-weight:600}
.onboard .keyrow .btn{flex:none;padding-inline:22px}
.eye{width:46px!important;height:auto!important;border:1px solid var(--line)!important;background:var(--bg2)!important}

/* ===== کلیل ===== */
.keystate{font-size:14px;color:var(--muted);padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.03);border:1px solid var(--line)}
.keystate code{color:var(--teal);font-size:13px}
.kmsg{white-space:pre-line;line-height:1.7}
.kmsg.warn{color:var(--gold)}
.kmsg:empty{display:none}
.modal-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;font-size:13px}
.modal-foot a{color:var(--teal);text-decoration:none}
.linkbtn{background:none;border:0;cursor:pointer;font-size:13px;color:var(--muted);text-decoration:underline;padding:0}
.linkbtn.danger{color:var(--danger)}
.spin{width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;display:inline-block;animation:sp .7s linear infinite;vertical-align:-2px}
@keyframes sp{to{transform:rotate(360deg)}}

/* ===== کارکردن ===== */
.big-inline{padding:13px 30px;font-size:16px;border-radius:14px;margin-top:4px}
.btn.big.soft{background:rgba(255,255,255,.05);border:1px solid var(--line);color:var(--text);font-weight:600;font-size:15px;padding:11px}
.btn.big.soft:hover{background:rgba(255,255,255,.09)}
.style-card{padding:0}
.style-card summary{list-style:none;cursor:pointer;padding:14px 18px;display:flex;justify-content:space-between;align-items:center;gap:10px;font-weight:700}
.style-card summary::-webkit-details-marker{display:none}
.style-card summary::after{content:'⌄';color:var(--muted);font-size:18px;line-height:1;transition:.2s}
.style-card[open] summary::after{transform:rotate(180deg)}
.style-card summary small{font-weight:400;font-size:12px;margin-inline-start:auto}
.style-body{padding:0 18px 18px;display:flex;flex-direction:column;gap:14px}
.empty-ic{width:64px;height:64px;border-radius:18px;display:grid;place-items:center;color:var(--violet);background:rgba(139,92,246,.1);margin-bottom:4px}
.exports{grid-template-columns:1fr auto}
.exports #dlVtt{padding-inline:16px}
.exports.ready{background:linear-gradient(180deg,rgba(45,212,191,.06),transparent)}
.exports.ready #dlSrt{box-shadow:0 0 0 4px rgba(45,212,191,.15)}

@media (max-width:640px){
  .stepper li span{display:none}
  .stepper li.on span{display:inline}
  .onboard{padding:20px}
  .ob-head{flex-direction:column}
  .onboard .keyrow{flex-wrap:wrap}
  .onboard .keyrow input{flex-basis:calc(100% - 54px)}
  .onboard .keyrow .btn{flex-basis:100%}
  .modal-actions{grid-template-columns:1fr}
  .brand small{display:none}
}
.howto li{display:block;position:relative;padding-inline-start:36px;line-height:1.9}
.howto li::before{position:absolute;inset-inline-start:0;top:3px}
.count:empty{display:none}
.modal-actions .btn{white-space:nowrap}
