@font-face{font-family:MG;src:url(fonts/Vazirmatn.woff2)}
:root{color-scheme:dark;--bg:#160f0a;--panel:rgba(255,236,207,.075);--panel-strong:#241912;--border:rgba(244,207,159,.18);--muted:#b69f86;--blue:#c99755;--radius:14px}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:#160f0a;color:#fffaf2;font-family:MG,-apple-system,BlinkMacSystemFont,"SF Pro Display",system-ui;-webkit-tap-highlight-color:transparent}
body{background:#3b342e;overscroll-behavior:none}
button,.file,input,select{font:inherit}
button,.file{border:1px solid var(--border);background:var(--panel);color:#fff;border-radius:12px;padding:11px 12px;font-weight:750;text-align:center;transition:transform .12s,background .15s,border-color .15s;min-height:42px}
button:active,.file:active{transform:scale(.97)}
button:disabled{opacity:.32;transform:none}
.primary{background:var(--blue)!important;border-color:var(--blue)!important;color:#170f09!important;box-shadow:0 8px 24px rgba(201,151,85,.24)}
.hidden{display:none!important}
.screen{display:none;width:min(100%,640px);min-height:100dvh;margin:0 auto;padding:max(14px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));direction:ltr;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y}
.screen.active{display:flex;flex-direction:column}
.license-status{align-self:center;margin:4px 0 10px;padding:7px 12px;border:1px solid rgba(201,151,85,.35);border-radius:999px;background:rgba(201,151,85,.12);color:#e8c99a;font-size:11px;font-weight:900;letter-spacing:.7px;direction:ltr;box-shadow:0 8px 22px rgba(0,0,0,.22)}
.license-status.compact{display:inline-flex;margin:2px 0 0;padding:2px 6px;font-size:8px;line-height:1.2;white-space:nowrap;align-self:flex-start;box-shadow:none;letter-spacing:.4px;max-width:max-content}
#home{background:linear-gradient(180deg,#080604 0%,#160f0a 52%,#2c1e13 100%);padding-inline:28px}
.brand{margin:auto;text-align:center}
.grid-logo{display:grid;grid-template-columns:repeat(3,20px);gap:4px;justify-content:center;margin:0 auto 28px}
.grid-logo i{width:20px;height:20px;background:linear-gradient(145deg,#f1d39e,#b47a3e);border-radius:5px}
.brand h1{font-family:ui-rounded,"Arial Rounded MT Bold",MG,sans-serif;font-size:30px;font-weight:900;letter-spacing:-.6px;margin:0 0 20px}
.brand p{font-size:12px;letter-spacing:3.6px;color:#92929b;margin:0}
#newDoc{font-size:16px;min-height:52px;margin:0 0 34px}
.project-manager-screen{background:#080604;padding-inline:22px}
.project-manager-head{display:flex;align-items:center;gap:14px;margin:6px 0 24px!important}
.project-manager-head button{min-width:82px!important;border-radius:24px!important;background:#151515!important;border-color:#40352a!important}
.project-manager-head h2{font-size:26px;margin:0}.project-manager-head small{color:var(--muted);font-size:13px}
.project-name-card{padding:16px;background:var(--panel);border:1px solid var(--border);border-radius:16px}
.project-name-card label{display:flex;flex-direction:column;gap:7px;color:#e7c79a;font-size:11px;font-weight:850;letter-spacing:.5px}
.project-name-card input{width:100%;min-height:44px;padding:9px 11px;background:#160f0a;color:#fffaf2;border:1px solid rgba(244,207,159,.24);border-radius:10px;direction:ltr}
.project-name-card button{width:100%;margin-top:12px;min-height:48px}
.project-list-head{display:flex;justify-content:space-between;align-items:center;margin:20px 2px 9px;color:#e7c79a;font-size:12px}
.project-list-head button{min-height:30px;padding:5px 9px;font-size:10px}
.project-list{display:flex;flex-direction:column;gap:8px;overflow:auto;min-height:70px}
.project-list-empty{padding:22px 12px;text-align:center;color:var(--muted);background:rgba(255,236,207,.04);border:1px dashed var(--border);border-radius:12px;font-size:12px}
.project-card{display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:12px;background:var(--panel);border:1px solid var(--border);border-radius:12px;color:#fffaf2}
.project-card .project-card-copy{display:flex;flex-direction:column;gap:4px;min-width:0}.project-card b{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.project-card small{color:var(--muted);font-size:10px}
.project-card .project-card-open{margin-left:auto;min-height:32px;padding:5px 10px;font-size:10px;flex:0 0 auto}
.project-card .project-card-delete{min-height:32px;padding:5px 8px;font-size:9px;flex:0 0 auto;color:#ff756d;border-color:rgba(255,90,80,.42);background:rgba(255,90,80,.08)}
.license-action{background:transparent;border-color:rgba(201,151,85,.48);color:#e7c79a;font-size:11px;min-height:40px}
#activateLicenseEditor{display:none!important}
#activateLicenseHome{width:100%;max-width:360px;align-self:center;margin:-20px auto 28px}
.links{display:flex;flex-direction:column;align-items:center;gap:7px;margin-bottom:18px}
.links a{color:#d7ad6b;text-decoration:none;font-size:13px;font-weight:650}
.screen>header{display:flex;align-items:center;gap:12px;min-height:54px;margin-bottom:12px}
.screen>header>button:first-child{width:42px;min-width:42px;padding:5px;font-size:28px;line-height:1}
.screen>header h2{font-size:25px;margin:0;line-height:1.15}
.screen>header small{display:block;color:var(--muted);font-size:12px;margin-top:4px}
#setup{padding-inline:22px;background:#080604;touch-action:pan-y}
.setup-nav{display:flex;justify-content:space-between;align-items:center;min-height:52px;margin:0 0 32px!important}
.setup-nav button{width:auto!important;min-width:98px!important;height:44px;padding:8px 16px!important;border-radius:24px!important;background:#151515!important;border-color:#303034!important;font-size:16px!important;font-weight:400!important}
.setup-nav #setupBack{margin-left:auto}
.setup-heading{margin-bottom:24px}
.setup-heading h2{font-size:28px;line-height:1.08;margin:0 0 28px;font-weight:850;letter-spacing:-.7px}
.setup-heading p{font-size:18px;color:#929299;margin:0}
#sizeStep,#backgroundStep{flex:1;min-height:0;position:relative;z-index:1}#sizeStep{overflow-y:auto;overscroll-behavior:contain;padding-bottom:4px}
.presets{display:grid;grid-template-columns:1fr 1fr;gap:12px;overflow:visible;padding:2px 0 20px;touch-action:pan-y}
.preset{min-height:120px;text-align:left;padding:15px;border:0;border-radius:15px;display:flex;flex-direction:column;justify-content:flex-end;background:#111}
.ratio-preview{display:block;border:2px solid #c99755;border-radius:4px;margin-bottom:auto;background:#2a1b10}
.preset.active{background:var(--blue);border-color:var(--blue)}
.preset.active .ratio-preview{border-color:#fff;background:rgba(255,255,255,.16)}
.preset b{font-size:17px}.preset small{display:block;color:#96969e;font-size:12px;margin-top:8px;font-weight:450}.preset.active small{color:#3b2413}
.custom-size-panel{margin:0 0 12px;padding:15px;background:rgba(255,236,207,.075);border:1px solid rgba(201,151,85,.38);border-radius:15px}
.custom-size-heading{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:11px}.custom-size-heading b{font-size:15px;letter-spacing:.4px}.custom-size-heading small,.custom-size-pixels{color:var(--muted);font-size:11px}
.custom-size-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.custom-size-grid label{display:flex;flex-direction:column;gap:5px;color:#e7c79a;font-size:10px;font-weight:800;letter-spacing:.3px}.custom-size-grid label:last-child{grid-column:1/-1}.custom-size-grid input{width:100%;min-height:40px;padding:8px 9px;background:#160f0a;color:#fffaf2;border:1px solid rgba(244,207,159,.24);border-radius:9px;font-size:14px;direction:ltr}.custom-size-pixels{display:block;margin-top:10px;direction:ltr}
#setupNext,#createDoc{min-height:52px;font-size:16px;margin-top:12px;position:relative;z-index:5;flex:0 0 auto}
#backgroundStep{display:flex;flex-direction:column;gap:12px}
.segmented{display:grid;grid-template-columns:1fr 1fr;background:#1d1d1f;border-radius:18px;padding:2px;height:34px}
.segmented button{min-height:30px;height:30px;padding:0;border:0;border-radius:16px;background:transparent;font-size:14px;font-weight:500}
.segmented button.selected{background:#69696f}
#setupBackgroundPreview{height:min(29dvh,212px);border-radius:20px;border:1px solid #38383c;background:#000;box-shadow:none}
.color-row,.switch-row{display:flex;justify-content:space-between;align-items:center;padding:15px 16px;background:#131313;border:0;border-radius:14px;font-size:16px;font-weight:650;min-height:60px}
.color-row{cursor:pointer}
input[type=color]{width:42px;height:42px;border:0;background:transparent;padding:0}
input[type=checkbox]{width:48px;height:26px;accent-color:var(--blue)}
.color-palette{display:flex;justify-content:center;gap:8px;padding:5px 0}
.color-palette button{width:31px;height:31px;min-height:31px;padding:0;border:1px solid #777;border-radius:50%;box-shadow:0 0 0 2px #000}
.color-palette button.selected{outline:2px solid #c99755;outline-offset:2px}
#editor{padding-top:max(8px,env(safe-area-inset-top));background:#3b342e;overflow:hidden}
.editor-head{gap:6px!important;margin-bottom:0!important;min-height:48px!important;z-index:10}
.editor-head>button{min-height:38px;height:38px;padding:7px 8px;font-size:10px;border-radius:10px;flex:0 0 auto}
.editor-head>button:first-child{width:38px!important;min-width:38px!important;font-size:22px!important}
.editor-head>div{display:flex;flex-direction:column;margin-right:auto;min-width:62px;max-width:116px;overflow:hidden}
.editor-head b{font-size:14px}.editor-head small{font-size:9px;margin:0;white-space:nowrap}
.editor-head .autosave-status{color:#d7ad6b;font-size:8px;letter-spacing:.25px}
#exportBtn{background:var(--blue);border-color:var(--blue);min-width:64px}
.toolbar{display:flex;gap:7px;overflow-x:auto;padding:7px;margin:5px 0 8px;background:var(--panel);border:1px solid rgba(255,255,255,.06);border-radius:14px;scrollbar-width:none;z-index:10}
.toolbar::-webkit-scrollbar{display:none}
.toolbar button{flex:0 0 62px;height:46px;min-height:46px;padding:4px;font-size:9px;border-radius:10px;background:rgba(255,255,255,.055);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.toolbar button i{height:18px;font:700 17px/18px -apple-system,BlinkMacSystemFont,sans-serif;font-style:normal}
.toolbar button span{font-size:9px;font-weight:800}
.toolbar .selected{background:var(--blue);border-color:var(--blue);color:#170f09}
#stage{position:relative;display:flex;align-items:center;justify-content:center;flex:0 0 auto;height:min(53dvh,520px);min-height:300px;overflow:hidden;border:1px solid #685a4e;border-radius:9px;background:#494139;box-shadow:0 12px 32px rgba(0,0,0,.35)}
canvas{display:block;touch-action:none;transform-origin:center;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-user-drag:none}
#stage{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
#controlsPanel{flex:1 1 238px;min-height:188px;max-height:none;overflow-y:auto;overscroll-behavior:contain;padding-bottom:max(96px,calc(env(safe-area-inset-bottom) + 76px));scroll-padding-bottom:max(96px,calc(env(safe-area-inset-bottom) + 76px));scrollbar-width:thin}
#controlsPanel::-webkit-scrollbar{width:4px}
.toolbar #clearSelection,.toolbar #deleteFrame{display:none!important}
.actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:9px}
.actions button,.actions .file{font-size:11px;min-height:45px;padding:10px 5px}
.secondary-actions{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:8px}
.secondary-actions button{min-height:42px;font-size:10px;padding-inline:4px}
.actions .license-action{grid-column:1/-1;margin-top:0}
.subject-hint{grid-column:1/-1;color:var(--muted);font-size:10px;text-align:center;direction:rtl;padding:2px 4px}
.subject-controls{display:flex;flex-direction:column;gap:8px;padding:10px 0 4px}
.subject-controls-row{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.subject-controls button{font-size:10px;min-height:40px;padding:7px 4px}
.subject-controls>label{display:flex;flex-direction:column;gap:5px;color:#e7c79a;font-size:10px;font-weight:850}
.subject-controls output{float:right;color:#e7c79a}
.file input{display:none}
.sliders{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
.text-controls{display:grid;grid-template-columns:1fr;gap:8px;margin-top:8px}
.sliders label,.text-controls label{background:var(--panel);border:1px solid rgba(255,255,255,.05);border-radius:10px;padding:10px 8px;font-size:10px;font-weight:700;min-height:54px}
.text-controls label.effect-active{border-color:var(--blue);box-shadow:0 0 0 1px rgba(201,151,85,.35),0 10px 28px rgba(201,151,85,.1)}
.sliders label:nth-child(3){grid-column:1/-1}
.sliders output{float:right;color:#e7c79a;font-variant-numeric:tabular-nums}
.sliders input{width:100%;accent-color:var(--blue)}
.effect-mode{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:8px}
.effect-mode button{min-height:30px;padding:5px 4px;border-radius:8px;background:rgba(255,255,255,.055);font-size:9px;font-weight:900}
.effect-mode button.selected{background:var(--blue);border-color:var(--blue);color:#170f09}
.corner-picker{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:6px;margin-top:7px}
.corner-picker button,.fade-actions button{min-height:31px;padding:5px 4px;border-radius:8px;background:rgba(255,255,255,.055);font-size:9px;font-weight:900}
.corner-picker button.selected,.fade-actions button:active{background:var(--blue);border-color:var(--blue);color:#170f09}
.fade-actions{display:grid;grid-template-columns:1fr 1fr 1.35fr;gap:6px;margin-top:7px}
.tool-actions{display:flex;gap:7px;margin-top:8px}
.tool-actions button{flex:1;min-height:42px;font-size:11px}
.tool-actions .danger{color:#ff5b57;border-color:rgba(255,69,58,.35)}
.color-control{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--panel);border:1px solid rgba(255,255,255,.08);border-radius:10px;padding:10px;font-size:11px;font-weight:800;text-align:left}
.text-align-control{display:grid;grid-template-columns:auto 1fr 1fr 1fr;align-items:center;gap:7px;background:var(--panel);border:1px solid rgba(255,255,255,.05);border-radius:10px;padding:8px;font-size:10px;font-weight:800}
.text-align-control span{color:#e7c79a}
.text-align-control button{min-height:34px;padding:6px 4px;font-size:9px;border-radius:8px;background:rgba(255,255,255,.055)}
.text-align-control button.selected{background:var(--blue);border-color:var(--blue);color:#170f09}
.video-export-options{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
.video-export-options label{display:flex;flex-direction:column;gap:6px;background:rgba(255,255,255,.06);border:1px solid var(--border);border-radius:12px;padding:10px;font-size:11px;font-weight:800}
.video-export-options select{width:100%;background:#160f0a;color:#fff;border:1px solid var(--border);border-radius:9px;padding:9px}
.video-export-options button{grid-column:1/-1}
.video-trim-dialog video{width:100%;max-height:42dvh;background:#000;border-radius:14px;margin:8px 0 10px}
.video-trim-dialog audio{width:100%;margin:8px 0 10px}
.video-trim-dialog .trim-info{display:flex;justify-content:space-between;gap:12px;color:#e7c79a;font-size:12px;font-weight:800;margin-bottom:8px;direction:ltr}
.video-trim-dialog label{display:block;background:rgba(255,255,255,.06);border:1px solid var(--border);border-radius:12px;padding:10px;margin:8px 0;font-size:11px;font-weight:850}
.video-trim-dialog output{float:right;color:#e7c79a}
.video-trim-dialog .trim-timeline{direction:ltr;padding:18px 12px 10px;touch-action:none;user-select:none}
.video-trim-dialog .trim-track{position:relative;height:38px;border-radius:11px;background:linear-gradient(90deg,#242833,#3b414c);border:1px solid rgba(255,255,255,.18);box-shadow:inset 0 0 0 1px rgba(0,0,0,.25);cursor:ew-resize}
.video-trim-dialog .trim-track:before{content:"";position:absolute;inset:7px 0;border-radius:5px;background:repeating-linear-gradient(90deg,rgba(255,255,255,.18) 0 2px,transparent 2px 18px);pointer-events:none}
.video-trim-dialog .trim-selection{position:absolute;top:0;bottom:0;left:0;width:100%;border-radius:10px;background:rgba(231,199,154,.28);border:1px solid #e7c79a;pointer-events:none}
.video-trim-dialog .trim-handle{position:absolute;top:-8px;width:18px;height:54px;padding:0;border:2px solid #fff;background:#e7c79a;border-radius:7px;transform:translateX(-50%);z-index:3;touch-action:none;box-shadow:0 3px 10px rgba(0,0,0,.4);cursor:ew-resize}
.video-trim-dialog .trim-handle:after{content:"";position:absolute;top:13px;bottom:13px;left:6px;width:2px;background:#5d4936;border-radius:2px}
.video-trim-dialog .trim-playhead{position:absolute;top:-5px;width:3px;height:48px;padding:0;border:0;background:#fff;border-radius:3px;transform:translateX(-50%);z-index:4;box-shadow:0 0 0 1px rgba(0,0,0,.35);pointer-events:none}
.video-trim-dialog .trim-times{display:flex;justify-content:space-between;direction:ltr;color:var(--muted);font-size:11px;font-weight:850;margin:0 4px 8px}
.video-trim-dialog .trim-times output{float:none;margin-left:4px}
.video-trim-dialog .trim-times span:nth-child(2){color:#e7c79a}
.video-trim-dialog small{display:block;color:var(--muted);line-height:1.8;margin-top:8px}
.export-progress-dialog{border:0;border-radius:24px;background:rgba(18,20,26,.96);color:#fff;padding:0;min-width:min(86vw,360px);box-shadow:0 20px 70px rgba(0,0,0,.5)}
.export-progress-dialog::backdrop{background:rgba(0,0,0,.7);backdrop-filter:blur(7px)}
.export-progress-card{padding:28px 26px;text-align:center;direction:ltr}
.export-progress-card h3{margin:9px 0 4px;font-size:18px;letter-spacing:.08em}
.export-progress-card p{margin:0 0 18px;color:var(--muted);font-size:12px}
.export-spinner{width:38px;height:38px;margin:0 auto;border:3px solid rgba(231,199,154,.25);border-top-color:#e7c79a;border-radius:50%;animation:mg-export-spin .8s linear infinite}
.export-progress-track{height:10px;border-radius:99px;background:#30343d;overflow:hidden;box-shadow:inset 0 1px 2px #111}
.export-progress-bar{height:100%;width:0;border-radius:99px;background:linear-gradient(90deg,#d59a52,#f0cf9d);transition:width .15s ease}
.export-progress-card strong{display:block;margin-top:10px;color:#e7c79a;font-size:16px}
.subject-extract-dialog{border:1px solid var(--border);border-radius:22px;background:rgba(36,25,18,.98);color:#fffaf2;padding:0;min-width:min(88vw,360px);box-shadow:0 20px 70px rgba(0,0,0,.55)}
.subject-extract-dialog::backdrop{background:rgba(0,0,0,.72);backdrop-filter:blur(7px)}
.subject-extract-card{padding:28px 24px;text-align:center;direction:rtl}.subject-extract-card h3{margin:14px 0 6px;font-size:18px}.subject-extract-card p{margin:0 0 10px;color:#e7c79a;font-size:12px}.subject-extract-card small{display:block;color:var(--muted);line-height:1.8;font-size:10px}
@keyframes mg-export-spin{to{transform:rotate(360deg)}}
.mini-swatch{display:inline-block;width:24px;height:24px;border-radius:50%;border:2px solid rgba(255,255,255,.55);background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.45)}
#textControls .color-control,#lineControls .color-control{width:100%;min-height:42px}
#fontPreview,#fontGallery button{font-weight:400!important}
.modal-screen{align-items:center;justify-content:center}
.license-card{width:min(420px,100%);text-align:center;background:#241912;border:1px solid rgba(244,207,159,.2);padding:25px;border-radius:22px;box-shadow:0 20px 60px #0009}
.license-card img{width:92px;border-radius:22px;box-shadow:0 0 38px rgba(201,151,85,.45)}
.license-card code{display:block;direction:ltr;word-break:break-all;background:#160f0a;padding:12px;margin:15px 0;border-radius:10px}
.license-help{color:#b69f86;line-height:1.9;margin:8px 0 14px}
.license-link{display:block;text-decoration:none;color:#170f09;font-weight:900;background:#c99755;padding:13px 16px;border-radius:13px;margin:12px 0}
.license-social{display:block;text-decoration:none;color:#d7ad6b;font-weight:800;margin:8px 0 12px}
.license-card input{width:100%;padding:13px;background:#160f0a;color:white;border:1px solid rgba(244,207,159,.22);border-radius:10px;margin:12px 0;direction:ltr}
input[type=range]{accent-color:var(--blue)}
@media(max-height:760px){#stage{height:min(46dvh,390px);min-height:238px}.toolbar button{height:40px;min-height:40px}.sliders{margin-top:5px}.brand img{width:78px;height:78px}#controlsPanel{flex-basis:250px;min-height:205px}}
@media(max-width:700px) and (max-height:820px){#setup{padding-top:max(9px,env(safe-area-inset-top));padding-bottom:max(9px,env(safe-area-inset-bottom))}.setup-nav{min-height:44px;margin-bottom:18px!important}.setup-nav button{height:40px!important;min-height:40px!important}.setup-heading{margin-bottom:16px}.setup-heading h2{font-size:25px;margin-bottom:14px}.setup-heading p{font-size:15px}.presets{gap:9px;padding-bottom:12px}.preset{min-height:102px;padding:12px}.preset b{font-size:15px}.preset small{font-size:10px;margin-top:5px}.ratio-preview{transform:scale(.9);transform-origin:left bottom}#setupNext,#createDoc{min-height:48px;margin-top:8px}}
