/* Maskan Mobile — editor UI. Neutral graphite surfaces, one blue accent; the brand colours live only in the exported video. */
@font-face { font-family: Vazirmatn; font-weight: 100 900; src: url(fonts/Vazirmatn.woff2) format("woff2"); }

:root {
  --bg: #0d0e10; --panel: #16171a; --panel2: #1d1f23; --panel3: #272a2f; --line: #2a2d33;
  --text: #eceff3; --dim: #8b919a; --faint: #5b616a;
  --accent: #3d8bff; --accent-d: #2f74dc; --danger: #ff5c61; --ok: #37c48c;
  --tlh: 218px; --tbh: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none;
  font-family: Vazirmatn, system-ui, -apple-system, sans-serif; font-size: 15px; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hide { display: none !important; }
svg { display: block; }

#app { height: 100dvh; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }

/* ---------- top bar ---------- */
.top { flex: none; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { border-radius: 7px; }
.brand b { font-size: 15px; font-weight: 700; }
.ver { font-size: 10px; color: var(--faint); direction: ltr; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel3); font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:active { filter: brightness(1.2); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; height: 34px; padding: 0 14px; }
.btn.big { height: 46px; padding: 0 22px; font-size: 15px; background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: 10px; }
.icon-btn:active { background: var(--panel3); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }

/* ---------- stage ---------- */
.stage-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 12px; }
.stage { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; background: #000; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.stage canvas { width: 100%; height: 100%; display: block; }
.stage.empty-mode { aspect-ratio: auto; width: min(100%, 440px); height: min(100%, 340px); background: var(--panel); }
.stage.empty-mode canvas { display: none; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; text-align: center; padding: 20px; background: var(--panel); }
.empty p { margin: 0; color: var(--dim); font-size: 13px; line-height: 1.9; max-width: 320px; }
.toast { position: fixed; left: 50%; top: calc(58px + env(safe-area-inset-top)); transform: translate(-50%, -8px); max-width: 92vw; background: #2d3036; color: var(--text);
  padding: 9px 16px; border-radius: 12px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.5); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- transport ---------- */
.transport { flex: none; height: 46px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 8px; direction: ltr; }
.tc { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); display: flex; gap: 6px; align-items: baseline; padding-left: 6px; }
.tc b { color: var(--text); font-weight: 600; font-size: 14px; }
.icon-btn.play { width: 44px; height: 44px; border-radius: 50%; background: var(--panel3); }
.tr-right { display: flex; justify-content: flex-end; }

/* ---------- bottom: timeline + toolbar (+ sheet over them) ---------- */
.bottom { position: relative; flex: none; height: calc(var(--tlh) + var(--tbh) + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); transition: height .2s ease; }
.bottom.tall { height: min(64dvh, 540px); }
.tl-host { height: var(--tlh); }
.toolbar { height: calc(var(--tbh) + env(safe-area-inset-bottom)); display: flex; gap: 2px; overflow-x: auto; padding: 4px 8px env(safe-area-inset-bottom); border-top: 1px solid var(--line); scrollbar-width: none; background: var(--panel); }
.toolbar::-webkit-scrollbar { display: none; }
.tb { flex: none; min-width: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; border-radius: 10px; font-size: 11px; color: var(--text); padding: 4px 6px; }
.tb:active { background: var(--panel3); }
.tb.danger { color: var(--danger); }
.tb.dim { color: var(--dim); }
.tb.sep { min-width: 1px; width: 1px; padding: 0; margin: 12px 6px; background: var(--line); }

/* ---------- timeline ---------- */
.tl { position: relative; background: var(--bg); }
.tl-scroll { position: absolute; inset: 0; overflow: auto; direction: ltr; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.tl-scroll::-webkit-scrollbar { display: none; }
.tl-inner { position: relative; min-height: 100%; padding-top: 4px; }
.tl-row { position: absolute; left: 0; right: 0; }
.tl-ruler { z-index: 1; }
.tl-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid #34383f; font-size: 10px; color: var(--dim); padding-left: 4px; line-height: 20px; pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-clip { position: absolute; top: 0; bottom: 0; border-radius: 7px; overflow: hidden; }
.tl-v { background: #23252a; box-shadow: 0 0 0 1px #3a3e45 inset; }
.tl-th { position: absolute; inset: 0; }
.tl-tile { position: absolute; top: 0; bottom: 0; background: #2a2d33 center / cover no-repeat; }
.tl-badge { position: absolute; left: 5px; bottom: 3px; font-size: 10px; background: rgba(0,0,0,.62); padding: 1px 6px; border-radius: 5px; display: flex; gap: 3px; align-items: center; direction: ltr; font-variant-numeric: tabular-nums; pointer-events: none; }
.tl-a { background: #131518; box-shadow: 0 0 0 1px #24272c inset; }
.tl-a canvas { display: block; }
.tl-s { background: #34383f; color: #dfe3e8; font-size: 11px; line-height: 28px; padding: 0 7px; white-space: nowrap; direction: rtl; box-shadow: 0 0 0 1px #4a4f58 inset; }
.tl-s span { display: block; overflow: hidden; text-overflow: ellipsis; }
.tl-m { background: var(--c); color: #fff; font-size: 11px; line-height: 28px; }
.tl-m span { display: flex; align-items: center; gap: 5px; height: 100%; padding: 0 9px; white-space: nowrap; direction: rtl; overflow: hidden; pointer-events: none; }
.tl-m.on { touch-action: none; }
.tl-clip.on { outline: 2px solid #fff; outline-offset: -2px; z-index: 3; }
.tl-v.on { overflow: visible; }
.tl-h { position: absolute; top: 0; bottom: 0; width: 17px; background: #fff; display: flex; align-items: center; justify-content: center; touch-action: none; z-index: 4; cursor: ew-resize; }
.tl-h::after { content: ""; width: 2px; height: 18px; background: #6b7078; border-radius: 1px; }
.tl-h.l { left: 0; border-radius: 7px 0 0 7px; }
.tl-h.r { right: 0; border-radius: 0 7px 7px 0; }
.tl-add { position: absolute; top: 8px; width: 46px; height: 46px; border-radius: 10px; background: var(--panel3); display: flex; align-items: center; justify-content: center; }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; z-index: 6; pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.tl-playhead::before { content: ""; position: absolute; top: -1px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.tl-zoom { position: absolute; right: 6px; top: 2px; display: flex; gap: 5px; z-index: 7; }
.tl-zoom button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(40,43,49,.9); display: flex; align-items: center; justify-content: center; }

/* ---------- sheet ---------- */
.sheet { position: absolute; inset: 0; background: var(--panel); border-radius: 14px 14px 0 0; transform: translateY(104%); transition: transform .22s ease; display: flex; flex-direction: column; z-index: 30; box-shadow: 0 -8px 30px rgba(0,0,0,.4); visibility: hidden; }
.sheet.open { transform: none; visibility: visible; }
.sheet-head { flex: none; height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }
.sheet-head b { font-size: 14px; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); }

/* ---------- forms ---------- */
label.f { display: block; font-size: 12px; color: var(--dim); margin: 0 0 4px; }
.f input[type=text], .f input[type=number], .f input[type=password], .f select, input.in, select.in, textarea.in {
  width: 100%; margin-top: 4px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 15px; outline: none; }
.f input:focus, .f select:focus, input.in:focus, textarea.in:focus { border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input.ltr, .ltr { direction: ltr; text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .btn.sm, .row > .fix { flex: none; }
.stack > * + * { margin-top: 10px; }
.note { font-size: 12.5px; color: var(--dim); line-height: 1.9; }
.msg { font-size: 13px; min-height: 18px; color: var(--dim); }
.msg.err { color: var(--danger); } .msg.ok { color: var(--ok); }
.bar { height: 6px; border-radius: 3px; background: var(--panel3); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.sec-title { font-size: 12px; color: var(--dim); margin: 16px 0 8px; font-weight: 600; }

/* subtitle lines */
.ln { background: var(--panel2); border-radius: 12px; padding: 8px 10px; margin-top: 8px; border: 1px solid transparent; }
.ln.on { border-color: var(--accent); }
.ln .t { font-size: 11px; color: var(--faint); direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.ln textarea { width: 100%; border: 0; outline: none; background: transparent; resize: none; font-size: 16px; padding: 2px 0; direction: rtl; }
.ln .acts { display: flex; gap: 6px; }
/* suggestions */
.sg { display: flex; gap: 10px; align-items: flex-start; background: var(--panel2); border-radius: 12px; padding: 10px; margin-top: 8px; }
.sg input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.sg.off { opacity: .45; }
.sg b { font-size: 14px; } .sg small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
/* fixes */
.fx { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.fx button { background: none; border: 0; color: var(--dim); font-size: 18px; padding: 0 8px; }
textarea.cap { width: 100%; min-height: 220px; line-height: 1.8; }
.seg { display: flex; background: var(--panel2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px 4px; font-size: 13px; color: var(--dim); }
.seg button.on { background: var(--panel3); color: var(--text); }
