/* ════════════════════════════════════════════════════════════
   استودیو متن آلفا — style.css
   تم «لاجورد و زر»: سرمه‌ای لاجوردی نسخه‌های خطی + طلای تذهیب + فیروزه‌ای کاشی.
   رابط آرام و تیره است تا خودِ تصویر بدرخشد؛ طلا فقط برای عمل اصلی و انتخاب.
   ════════════════════════════════════════════════════════════ */
@font-face { font-family: 'AlphaUI'; src: url('/textonimage/static/fonts/ui.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
    --lapis-0: #070c22;
    --lapis-1: #0b1230;
    --lapis-2: #121b42;
    --lapis-3: #1a2556;
    --lapis-4: #24316b;
    --gold: #e8bc5f;
    --gold-2: #f6dc9a;
    --gold-ink: #2a1d05;
    --firuzeh: #3cc7b6;
    --paper: #f5ecd9;
    --muted: #a7aed0;
    --faint: #6f78a3;
    --rose: #ff6b7a;
    --line: rgba(232, 188, 95, .13);
    --line-2: rgba(232, 188, 95, .26);
    --hair: rgba(245, 236, 217, .08);
    --foil: linear-gradient(100deg, #b98a2e 0%, #f7e3a3 28%, #d6a548 52%, #fff1c7 70%, #b98a2e 100%);
    --font: 'AlphaUI', 'Vazirmatn', Tahoma, system-ui, sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
    --r-lg: 22px;
    --r-md: 14px;
    --r-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--lapis-1); }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--paper); font-family: var(--font); font-size: 15px; line-height: 1.7;
    background: var(--lapis-1); overscroll-behavior: none;
}
body.noscroll { overflow: hidden; }
button, input, select, textarea { font-family: inherit; color: inherit; font-size: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .35; cursor: default; }
[hidden] { display: none !important; }
.ico { display: block; flex: none; }
.ico-wrap { display: inline-grid; place-items: center; line-height: 0; }
:focus-visible { outline: 2px solid var(--firuzeh); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(232, 188, 95, .35); }
* { scrollbar-width: thin; scrollbar-color: rgba(232, 188, 95, .25) transparent; }
.muted { color: var(--muted); }
.pad { padding: 14px 4px; }

/* ───────── دکمه‌ها ───────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
    border-radius: 12px; font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--foil); color: var(--gold-ink); box-shadow: 0 8px 24px -12px rgba(232, 188, 95, .7), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.soft { background: var(--lapis-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--hair); }
.btn.soft:hover { background: var(--lapis-4); }
.btn.ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.danger, .btn.soft.danger { color: var(--rose); }
.btn.big { min-height: 56px; padding: 0 22px; font-size: 16px; border-radius: 16px; }
.btn.full { width: 100%; margin-top: 10px; }
.btn.grow { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--paper); transition: background .15s; }
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.row-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.btn-grid .btn { justify-content: flex-start; padding: 0 12px; font-weight: 500; }

/* ════════════════════ صفحهٔ اصلی ════════════════════ */
.home { max-width: 1080px; margin: 0 auto; padding: calc(10px + var(--safe-t)) 16px calc(40px + var(--safe-b)); position: relative; }
.home::before {
    /* نقش گره‌چینی بسیار کم‌رنگ پشت سربرگ */
    content: ''; position: absolute; inset: 0 0 auto 0; height: 560px; z-index: -1; pointer-events: none;
    background:
        radial-gradient(600px 340px at 85% 0%, rgba(232, 188, 95, .12), transparent 70%),
        radial-gradient(520px 340px at 10% 30%, rgba(60, 199, 182, .08), transparent 70%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23e8bc5f' stroke-opacity='.07' stroke-width='1'%3E%3Cpath d='M48 8l11.3 28.7L88 48 59.3 59.3 48 88 36.7 59.3 8 48l28.7-11.3z'/%3E%3Cpath d='M48 26l6.4 15.6L70 48l-15.6 6.4L48 70l-6.4-15.6L26 48l15.6-6.4z'/%3E%3C/g%3E%3C/svg%3E");
    -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent);
    mask-image: linear-gradient(180deg, #000 40%, transparent);
}
.h-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 12px; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .8); }
.brand b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -3px; }

.hero { padding: 30px 0 18px; }
.hero-title {
    margin: 0; font-size: clamp(54px, 13vw, 112px); line-height: 1.12; font-weight: 400;
    background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 10px 26px rgba(232, 188, 95, .18)); opacity: .0; transition: opacity .5s ease;
}
body.hero-ready .hero-title, .hero-title { opacity: 1; }
.hero-sub { max-width: 46ch; color: var(--muted); margin: 12px 0 22px; font-size: 15px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { flex: 1 1 200px; }

.sizes, .sizegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 14px; }
.szt {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px; border-radius: 14px;
    background: var(--lapis-2); box-shadow: inset 0 0 0 1px var(--hair); transition: background .15s, box-shadow .15s;
}
.szt i { display: block; width: auto; height: 34px; max-width: 54px; border-radius: 4px; border: 1.6px solid var(--gold); opacity: .85; }
.szt span { font-size: 12.5px; font-weight: 600; }
.szt small { font-size: 10.5px; color: var(--faint); direction: ltr; }
.szt:hover { background: var(--lapis-3); }
.szt.on { box-shadow: inset 0 0 0 1.6px var(--gold); background: var(--lapis-3); }

.h-sec { margin-top: 34px; }
.h-sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.h-sec-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.h-sec-head small { color: var(--faint); font-size: 12.5px; }

.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.tcard { display: flex; flex-direction: column; gap: 6px; text-align: right; }
.tcard canvas { width: 100%; height: auto; border-radius: 14px; background: var(--lapis-2); box-shadow: 0 10px 28px -16px rgba(0, 0, 0, .9), inset 0 0 0 1px var(--hair); transition: transform .18s; }
.tcard:hover canvas { transform: translateY(-2px); }
.tcard span { font-size: 13px; font-weight: 600; color: var(--muted); padding-inline: 2px; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-items: start; }
.pcard { position: relative; display: flex; flex-direction: column; gap: 6px; }
.popen { display: block; width: 100%; }
.pthumb { width: 100%; max-height: 240px; border-radius: 14px; background: var(--lapis-2) center/cover no-repeat; box-shadow: inset 0 0 0 1px var(--hair); }
.pmeta { display: flex; flex-direction: column; padding-inline: 2px 34px; }
.pmeta b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta small { color: var(--faint); font-size: 11.5px; }
.pmore { position: absolute; left: 0; bottom: 2px; color: var(--muted); }
.h-foot { margin-top: 40px; color: var(--faint); font-size: 12.5px; text-align: center; }
.drop-hint { position: fixed; inset: 12px; border: 2px dashed var(--gold); border-radius: 24px; display: grid; place-items: center; background: rgba(7, 12, 34, .8); font-size: 22px; font-weight: 800; z-index: 90; pointer-events: none; }

/* ════════════════════ ویرایشگر ════════════════════ */
.editor { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--lapis-0); }
.etop {
    display: flex; align-items: center; gap: 4px; padding: calc(6px + var(--safe-t)) 8px 6px; background: var(--lapis-1);
    border-bottom: 1px solid var(--hair); z-index: 5;
}
.e-title { flex: 1; min-width: 0; text-align: right; padding: 6px 8px; border-radius: 10px; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-title:hover { background: rgba(255, 255, 255, .05); }
.etop-actions { display: flex; align-items: center; gap: 2px; }
.etop-actions .btn { margin-inline-start: 6px; min-height: 38px; padding: 0 14px; }

.ebody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage {
    position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
    background-color: var(--lapis-0);
    background-image: radial-gradient(rgba(245, 236, 217, .06) 1px, transparent 1px);
    background-size: 18px 18px;
}
.stage[data-mode="draw"] { cursor: crosshair; }
.stage[data-mode="pick"] { cursor: copy; }
.stage[data-mode="bgmove"] { cursor: move; }
.docwrap { position: absolute; transform-origin: 0 0; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 255, 255, .05); }
.docwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#live { pointer-events: none; }
.guide { position: absolute; background: var(--firuzeh); box-shadow: 0 0 6px var(--firuzeh); pointer-events: none; z-index: 3; }
.guide.v { left: 50%; top: 0; bottom: 0; width: calc(1px * var(--inv, 1)); transform: translateX(-50%); }
.guide.h { top: 50%; left: 0; right: 0; height: calc(1px * var(--inv, 1)); transform: translateY(-50%); }

/* کادر انتخاب */
.selbox {
    position: absolute; pointer-events: none; z-index: 4; border-radius: calc(6px * var(--inv, 1));
    outline: calc(1.5px * var(--inv, 1)) solid rgba(60, 199, 182, .95); box-shadow: 0 0 0 calc(3px * var(--inv, 1)) rgba(7, 12, 34, .25);
}
.selbox.locked { outline-style: dashed; outline-color: rgba(245, 236, 217, .55); }
.hb {
    position: absolute; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; pointer-events: auto;
    background: var(--paper); color: var(--lapis-1); box-shadow: 0 4px 12px -2px rgba(0, 0, 0, .55); transform: translate(-50%, -50%) scale(var(--inv, 1)); touch-action: none;
}
.hb.tr { left: 100%; top: 0; background: var(--rose); color: #fff; }
.hb.tl { left: 0; top: 0; }
.hb.bl { left: 0; top: 100%; background: var(--gold); color: var(--gold-ink); cursor: grab; }
.hb.br { left: 100%; top: 100%; }
.selbox.locked .hb.bl { display: none; }
.hs { position: absolute; display: none; width: 12px; height: 26px; border-radius: 6px; background: var(--firuzeh); pointer-events: auto; touch-action: none; transform: translate(-50%, -50%) scale(var(--inv, 1)); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.selbox.t-shape .hs { display: block; }
.hs.l { left: 0; top: 50%; cursor: ew-resize; } .hs.r { left: 100%; top: 50%; cursor: ew-resize; }
.hs.t { left: 50%; top: 0; width: 26px; height: 12px; cursor: ns-resize; } .hs.b { left: 50%; top: 100%; width: 26px; height: 12px; cursor: ns-resize; }

.fab { position: absolute; left: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(18, 27, 66, .9); box-shadow: inset 0 0 0 1px var(--line-2); z-index: 6; }
.mode-pill {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px;
    padding: 5px 6px 5px 14px; padding-inline: 14px 6px; border-radius: 99px; background: rgba(11, 18, 48, .92); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill-x { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--gold-ink); }

/* نوار ابزار */
.rail {
    display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; padding: 6px 6px calc(6px + var(--safe-b)); background: var(--lapis-1);
    border-top: 1px solid var(--hair); scrollbar-width: none; scroll-snap-type: x proximity;
}
.rail::-webkit-scrollbar { display: none; }
.rb {
    flex: none; width: 66px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 5px; border-radius: 12px;
    color: var(--muted); font-size: 11px; font-weight: 600; scroll-snap-align: start; transition: color .15s, background .15s;
}
.rb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rb:hover { color: var(--paper); }
.rb.on { color: var(--gold-2); background: rgba(232, 188, 95, .1); }
.rb.on .ico { filter: drop-shadow(0 0 6px rgba(232, 188, 95, .45)); }
.rb.done { color: var(--firuzeh); }

/* پنل تنظیمات */
.panel { background: var(--lapis-1); border-top: 1px solid var(--line); display: flex; flex-direction: column; max-height: min(44vh, 380px); min-height: 0; animation: up .2s ease; }
@keyframes up { from { transform: translateY(14px); opacity: .4; } to { transform: none; opacity: 1; } }
.phead { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 0 8px; }
.phead b { font-size: 13.5px; font-weight: 800; color: var(--gold-2); }
.pbody { overflow-y: auto; padding: 4px 14px 14px; overscroll-behavior: contain; }
.psec { padding: 10px 0; border-top: 1px solid var(--hair); }
.psec:first-child { border-top: 0; }
.psec-t { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 6px 0 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; line-height: 1.8; }
.hint.ok { color: var(--firuzeh); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; color: var(--muted); }
.empty p { margin: 0; }

/* اسلایدر */
.srow { padding: 6px 0 4px; }
.srow.compact { padding: 2px 0; }
.slabel { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--paper); margin-bottom: 2px; }
.sv { font-size: 12px; color: var(--gold-2); min-width: 44px; text-align: center; padding: 1px 8px; border-radius: 8px; background: rgba(232, 188, 95, .09); font-variant-numeric: tabular-nums; }
.sv.resettable { cursor: pointer; }
input[type=range] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; touch-action: pan-y;
    --p: 50%;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to left, var(--gold) var(--p), var(--lapis-4) var(--p)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--lapis-4); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--paper); border: 3px solid var(--gold); box-shadow: 0 3px 8px rgba(0, 0, 0, .5); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 3px solid var(--gold); }

/* گزینه‌های چندتایی */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--lapis-0); margin: 6px 0; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; min-height: 36px; padding: 0 10px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--lapis-3); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.icons { max-width: 240px; }

.trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; cursor: pointer; }
.tl { display: inline-flex; align-items: center; gap: 8px; }
.tl b { font-weight: 600; font-size: 14px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--lapis-4); transition: background .18s; }
.switch i::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform .18s; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.switch input:checked + i { background: var(--gold); }
.switch input:checked + i::after { transform: translateX(-18px); }
.switch input:focus-visible + i { outline: 2px solid var(--firuzeh); outline-offset: 2px; }

/* رنگ‌ها */
.colors { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 10px; scrollbar-width: none; }
.colors::-webkit-scrollbar { display: none; }
.sw { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); position: relative; }
.sw.on { box-shadow: 0 0 0 2px var(--lapis-1), 0 0 0 4px var(--gold); }
.sw.tool { display: grid; place-items: center; background: var(--lapis-3); color: var(--paper); }
.sw.rainbow { background: conic-gradient(#ff4d4d, #ffd23f, #2ec27e, #18d4ff, #6c4cff, #ff5cc8, #ff4d4d); cursor: pointer; overflow: hidden; }
.sw.rainbow input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

/* گرادیان */
.gpresets { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; scrollbar-width: none; }
.gsw { flex: none; width: 46px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.gbar { height: 14px; border-radius: 8px; margin: 6px 0 8px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.gstops { display: flex; gap: 8px; flex-wrap: wrap; }
.gdot { position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--lapis-1), 0 0 0 3px rgba(255, 255, 255, .25); display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.gdot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.gdot.add { background: var(--lapis-3); color: var(--paper); }

/* تراشه‌ها */
.chips { display: flex; gap: 6px; padding: 6px 0; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; }
.chip { flex: none; min-height: 34px; padding: 0 13px; border-radius: 99px; background: var(--lapis-2); box-shadow: inset 0 0 0 1px var(--hair); font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chip.on { color: var(--gold-ink); background: var(--gold); box-shadow: none; }
.chip.add { color: var(--firuzeh); }
.chip .msw { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.4); margin-inline-end: 3px; }
.chip.mchip { padding-inline-start: 8px; }
.chip.sym { min-width: 40px; justify-content: center; font-size: 17px; color: var(--paper); }

/* فونت‌ها */
@keyframes load { 0% { transform: scaleX(.1); } 50% { transform: scaleX(1); } 100% { transform: scaleX(.1); } }

/* استایل‌ها */
.stgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; padding-top: 6px; }
.sttile { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 4px; border-radius: 12px; background: var(--lapis-2); box-shadow: inset 0 0 0 1px var(--hair); }
.sttile canvas { width: 100%; height: auto; aspect-ratio: 220/120; border-radius: 9px; background: repeating-conic-gradient(#2a3a7a 0 25%, #24316b 0 50%) 0 0/14px 14px; }
.sttile span { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; }
.sttile.on { box-shadow: inset 0 0 0 2px var(--gold); }

/* شکل‌ها و شکلک‌ها */
.shgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; padding-top: 6px; }
.shtile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; background: var(--lapis-2); box-shadow: inset 0 0 0 1px var(--hair); font-size: 11.5px; color: var(--muted); }
.shtile canvas { width: 44px; height: 44px; }
.shtile.on { box-shadow: inset 0 0 0 2px var(--gold); }
.emgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 4px; }
.em { height: 48px; font-size: 28px; border-radius: 10px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.em:hover { background: var(--lapis-2); }

/* فیلترها */
.flist { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; }
.ftl { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ftl canvas { width: 76px; height: 76px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--hair); background: var(--lapis-2); }
.ftl.on { color: var(--gold-2); }
.ftl.on canvas { box-shadow: 0 0 0 2px var(--lapis-1), 0 0 0 4px var(--gold); }

.feature { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: linear-gradient(135deg, rgba(60, 199, 182, .12), rgba(232, 188, 95, .08)); margin: 6px 0 12px; }
.feature-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--lapis-3); color: var(--firuzeh); }
.feature b { font-size: 14.5px; }
.feature p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.wh { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.wh label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.wh input { width: 96px; height: 40px; border-radius: 10px; border: 0; background: var(--lapis-0); box-shadow: inset 0 0 0 1px var(--line); padding: 0 10px; direction: ltr; text-align: center; }
.wh > span { padding-bottom: 8px; color: var(--faint); }

/* ════════════════════ ویرایش متن ════════════════════ */
.texted { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: rgba(7, 12, 34, .88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); padding: calc(8px + var(--safe-t)) 12px calc(10px + var(--safe-b)); }
.texted-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.texted-top b { font-size: 14px; color: var(--muted); font-weight: 600; }
.texted textarea {
    flex: 1; width: 100%; margin: 14px 0; resize: none; border: 0; outline: none; background: transparent; color: #fff;
    font-size: clamp(28px, 7vw, 46px); line-height: 1.55; text-align: center; caret-color: var(--gold);
}
.texted textarea::placeholder { color: rgba(245, 236, 217, .3); }
.texted-bottom { display: flex; flex-direction: column; gap: 2px; max-width: 900px; width: 100%; margin: 0 auto; }

/* ════════════════════ پنل پایین (Sheet) ════════════════════ */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(4, 7, 20, .6); animation: fade .2s ease both; }
.sheet {
    position: relative; width: 100%; max-width: 560px; max-height: 86vh; display: flex; flex-direction: column; background: var(--lapis-1);
    border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .9), inset 0 1px 0 var(--line-2); animation: sheetUp .24s cubic-bezier(.2, .8, .2, 1) both;
    padding-bottom: var(--safe-b);
}
.sheet-wrap.out .sheet { animation: sheetDown .2s ease both; }
.sheet-wrap.out .sheet-bg { animation: fade .2s ease reverse both; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheetDown { to { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--lapis-4); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px 4px 16px; padding-inline: 16px 10px; }
.sheet-head b { font-size: 15px; font-weight: 800; }
.sheet-body { overflow-y: auto; padding: 4px 16px 18px; }
.dims { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.tinput { width: 100%; height: 46px; border-radius: 12px; border: 0; background: var(--lapis-0); box-shadow: inset 0 0 0 1px var(--line-2); padding: 0 14px; font-size: 15px; }
@media (min-width: 720px) {
    .sheet-wrap { align-items: center; }
    .sheet { border-radius: 22px; max-height: 80vh; }
}

/* لایه‌ها */
.llist { display: flex; flex-direction: column; gap: 6px; }
.lrow { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 14px; background: var(--lapis-2); }
.lrow.on { box-shadow: inset 0 0 0 1.6px var(--gold); }
.lrow.hid { opacity: .5; }
.lthumb { width: 46px; height: 46px; flex: none; border-radius: 10px; background: repeating-conic-gradient(#2a3a7a 0 25%, #24316b 0 50%) 0 0/12px 12px; }
.lname { flex: 1; min-width: 0; text-align: right; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 8px 4px; }

/* در حال انجام */
.busy { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(4, 7, 20, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.busy-card { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: 16px; background: var(--lapis-2); box-shadow: inset 0 0 0 1px var(--line-2); font-weight: 600; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(232, 188, 95, .25); border-top-color: var(--gold); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.toasts { position: fixed; z-index: 95; left: 50%; transform: translateX(-50%); bottom: calc(120px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(92vw, 460px); }
.toast { padding: 10px 16px; border-radius: 14px; background: rgba(26, 37, 86, .97); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8), inset 0 0 0 1px var(--line-2); font-size: 13.5px; font-weight: 600; text-align: center; animation: sheetUp .22s ease both; }
.toast.ok { box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(60, 199, 182, .5); }
.toast.error { box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 107, 122, .6); color: #ffd6da; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }

/* ════════════════════ دسکتاپ ════════════════════ */
body[data-view="editor"] .toasts { bottom: auto; top: calc(64px + var(--safe-t)); }
.hero-art { display: none; }
@media (min-width: 900px) {
    .hero { display: grid; grid-template-columns: 1fr 400px; column-gap: 40px; align-items: center; }
    .hero > :not(.hero-art) { grid-column: 1; }
    .hero-art { display: block; grid-column: 2; grid-row: 1 / span 4; position: relative; height: 430px; }
    .hero-art canvas { position: absolute; border-radius: 18px; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .95), 0 0 0 1px rgba(232, 188, 95, .18); opacity: 0; transition: opacity .6s ease, transform .6s ease; }
    #hero-a { width: 250px; height: auto; right: 10px; top: 0; transform: rotate(4deg) translateY(10px); }
    #hero-b { width: 220px; height: auto; left: 0; top: 150px; transform: rotate(-6deg) translateY(10px); }
    #hero-a.ready { opacity: 1; transform: rotate(4deg); }
    #hero-b.ready { opacity: 1; transform: rotate(-6deg); }
}
@media (min-width: 980px) {
    .ebody { flex-direction: row; }
    .rail { order: 0; flex-direction: column; width: 84px; overflow-x: hidden; overflow-y: auto; padding: 8px 6px; border-top: 0; border-left: 1px solid var(--hair); scroll-snap-type: none; }
    .rb { width: 100%; padding: 9px 2px 7px; }
    .panel { order: 1; width: 340px; max-height: none; border-top: 0; border-left: 1px solid var(--line); animation: none; }
    .stage { order: 2; }
    .etop { padding-inline: 14px; }
    .toasts { bottom: 30px; }
    .hero { padding-top: 54px; }
}
@media (max-width: 380px) {
    .rb { width: 58px; font-size: 10.5px; }
    .etop-actions .btn span:last-child { display: none; }
    .etop-actions .btn { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── پنل فونت (سبک متن‌نگار) ── */
.fbar { display: flex; align-items: center; gap: 4px; padding: 4px 0 10px; }
.ftabs { flex: 1; min-width: 0; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--lapis-2); box-shadow: inset 0 0 0 1px var(--hair); overflow-x: auto; scrollbar-width: none; }
.ftabs::-webkit-scrollbar { display: none; }
.ftab { flex: 1 1 auto; height: 36px; min-width: 0; padding: 0 9px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.ftab.on { background: #1a6dff; color: #fff; box-shadow: 0 2px 10px rgba(26, 109, 255, .45); }
.ficon { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--paper); transition: background .15s, color .15s; }
.ficon.on { color: #ff5470; background: var(--lapis-2); }
.fsearch { width: 100%; height: 42px; margin-bottom: 10px; padding: 0 16px; border: 0; outline: 0; border-radius: 999px; background: var(--lapis-2); color: var(--paper); font: inherit; box-shadow: inset 0 0 0 1px var(--hair); }
.fsearch:focus { box-shadow: inset 0 0 0 2px var(--gold); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 2px 0 6px; }
.fgrid .fempty { grid-column: 1 / -1; text-align: center; }
.fcard {
    --bg: #e6ebff; --fg: #1f6bff;
    position: relative; height: 106px; padding: 12px 6px 8px; border-radius: 14px; overflow: hidden;
    background: var(--bg); color: var(--fg);
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .3); transition: transform .12s, box-shadow .15s;
}
.fcard:active { transform: scale(.97); }
.fcard.on { box-shadow: 0 0 0 3px var(--gold), 0 3px 10px rgba(0, 0, 0, .3); }
.fcard .fn { flex: 1; display: flex; align-items: center; max-width: 100%; font-size: 23px; line-height: 1.5; color: var(--fg); opacity: .3; transition: opacity .25s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard.en .fn { direction: ltr; font-size: 20px; }
.fcard.ready .fn { opacity: 1; }
.fcard .fheart { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(229, 57, 79, .14); color: #e5394f; }
.fcard .fheart.on { background: #e5394f; color: #fff; }
.fcard.loading::after { content: ''; position: absolute; inset: auto 10px 4px; height: 2px; border-radius: 2px; background: var(--fg); animation: load 1s ease-in-out infinite; }
.t-blue   { --bg: #e6ebff; --fg: #1f6bff; }
.t-yellow { --bg: #fbebd3; --fg: #e49a14; }
.t-pink   { --bg: #f7d4ea; --fg: #c4308a; }
.t-purple { --bg: #ddd4f3; --fg: #5a3db3; }
.t-green  { --bg: #d6ede3; --fg: #2f9a6c; }
.t-red    { --bg: #f9d7d7; --fg: #d63c3c; }
.fcard.fadd { background: var(--lapis-2); color: var(--gold); gap: 6px; justify-content: center; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13px; }
