/* Editor screen: layout modelled on the reference screenshot (dark neutral, black preview, track rail). Loaded last. */
#editor{--e-bg:#161618;--e-pn:#1c1c1e;--e-chip:#2c2c2e;--e-mu:#8e8e93;--e-tx:#f2f2f4;--e-ex:linear-gradient(100deg,#e3e6ff,#aef3f0);background:var(--e-bg)}

/* ---- top bar ---- */
#top{background:var(--e-bg);border:0;gap:6px;padding:calc(env(safe-area-inset-top) + 10px) 12px 10px 8px;min-height:64px}
#top button{background:none;border:0;color:var(--e-tx);min-width:44px;min-height:44px;padding:0;display:grid;place-items:center;border-radius:12px}
#top button:hover{background:rgba(255,255,255,.06)}
#top .respill{margin-left:auto;display:block}
#top .res{background-color:var(--e-chip);border:0;border-radius:10px;color:var(--e-tx);font-size:17px;font-weight:600;min-height:44px;padding:0 34px 0 16px;cursor:pointer}
#top .res option{background:#2c2c2e;color:#fff}
#top #bExport.pri{background:var(--e-ex);color:#14141a;border:0;border-radius:14px;min-width:0;min-height:48px;padding:0 20px;font-size:19px;font-weight:600;display:block}
#top #bExport.pri:hover{filter:brightness(1.06);background:var(--e-ex)}

/* ---- preview: flat black, edge to edge ---- */
#stage{padding:0 7px;gap:0;background:var(--e-bg)}
#cwrap{background:#000;border-radius:0;box-shadow:none}
#cv{border-radius:0}
.ctl{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;min-height:58px;padding:2px 6px 0;background:var(--e-bg)}
.ctl>button:first-child{justify-self:start}
.ctl button{background:none;border:0;color:var(--e-tx);min-width:44px;min-height:44px;padding:0;display:grid;place-items:center;border-radius:12px}
.ctl button:hover{background:rgba(255,255,255,.06)}
#bPlay,#bPlay:hover{width:52px;height:52px;margin:0;border-radius:12px;background:none;color:var(--e-tx)}
#bPlay .ia{display:none}#bPlay.on .ia{display:block}#bPlay.on .ip{display:none}
.rt{justify-self:end;display:flex;align-items:center;gap:2px}
.snapb{position:relative;color:var(--e-tx)}
.snapb em{position:absolute;right:1px;bottom:3px;font-style:normal;font-size:10px;font-weight:700;color:var(--e-tx);letter-spacing:0}
.snapb:not(.on){color:var(--e-mu)}.snapb:not(.on) em{color:var(--e-mu)}
#bUndo.dis,#bRedo.dis{opacity:.4}
.rt button:hover{background:rgba(255,255,255,.06)}

/* ---- timeline ---- */
#tl{position:relative;display:flex;flex-direction:column;height:236px;max-height:none;background:var(--e-bg);border:0}
.timerow{flex:none;display:flex;align-items:center;height:34px;padding:0 14px}
#tc{min-width:0;text-align:left;font-size:15px;font-variant-numeric:tabular-nums;color:var(--e-mu)}#tc b{color:var(--e-tx);font-weight:500}
#tlbody{position:relative;flex:1;min-height:0;display:block}
#scroll{position:absolute;inset:0;overflow:auto hidden;scrollbar-width:none}#scroll::-webkit-scrollbar{display:none}
#scroll>*{min-width:100%}
#ruler{height:28px;background:none;border:0;cursor:default}
#ruler i{top:2px;height:auto;border:0;padding:0;font-size:13px;color:var(--e-mu);transform:translateX(-50%);line-height:20px}
#ruler i::after{content:"";position:absolute;left:50%;top:22px;width:3px;height:3px;margin-left:-1.5px;border-radius:50%;background:#48484a}
#tracks{display:flex;flex-direction:column;gap:8px;padding:10px 0 12px}
.trk{height:30px;border:0;flex:none}
.trk[data-t="v"]{height:50px}
.trk[hidden]{display:none}
.trk .clip{top:0;height:100%;border-radius:8px;border:0;box-shadow:none}
.clip.v{background-color:#2c2c2e}.clip.a{background:#1f5f58}.clip.t{background:#4a4a50}.clip.f{background:#5c3a80}
.clip.sel{outline:2px solid #fff;outline-offset:-1px}
.clip .h{background:#fff;width:16px}.clip .h::after{background:#1c1c1e}
.trk[data-t="v"] .clip.th{background-size:auto 100%;background-repeat:repeat-x}
.ghost{position:absolute;top:0;height:100%;display:flex;align-items:center;gap:8px;padding:0 14px 0 10px;border:0;border-radius:8px;background:var(--e-chip);color:var(--e-mu);font-size:15px;white-space:nowrap;touch-action:manipulation}
.ghost b{font-size:24px;font-weight:300;line-height:1;color:var(--e-mu)}
.ghost.end{width:200px;justify-content:center;color:#c7c7cc;font-size:19px;background:#3a3a3c}.ghost.end b{color:#c7c7cc}
.ghost.ga,.ghost.gt{background:transparent;padding-left:4px}
.ghost:hover{background:#3a3a3c}.ghost.ga:hover,.ghost.gt:hover{background:rgba(255,255,255,.05)}
#ph{background:#fff;box-shadow:none;width:3px;margin-left:-1.5px;border-radius:2px;top:2px;bottom:6px;z-index:9}
#ph::before{display:none}

/* left rail: sits above the scrolling clips so they slide underneath */
#rail{position:absolute;left:0;top:0;bottom:0;width:calc(50% - 12px);z-index:8;pointer-events:none;padding-top:38px;display:flex;flex-direction:column;gap:8px;background:linear-gradient(90deg,var(--e-bg) calc(100% - 14px),transparent)}
#rail>div{display:flex;justify-content:flex-end;align-items:center;gap:20px;padding-right:14px;height:30px;flex:none}
#rail>.rv{height:50px}
#rail button{pointer-events:auto;background:none;border:0;color:var(--e-tx);padding:0;display:grid;place-items:center;border-radius:8px}
.mclip{min-width:44px;gap:2px;margin-right:auto;margin-left:max(0px,calc(50% - 150px));font-size:12px;color:var(--e-mu)!important}
.mclip small{font-size:12px;line-height:1.15;text-align:center}.mclip svg{color:var(--e-tx)}
.mclip.on svg{color:#ff6b6b}
.cover{position:relative;width:50px;height:50px;overflow:hidden;border-radius:10px!important;background:#2c2c2e!important}
.cover i{position:absolute;inset:0;background:#3a3a3c center/cover}
.cover::after{content:"";position:absolute;inset:0;background:rgba(0,0,0,.38)}
.cover span{position:relative;z-index:1;display:grid;justify-items:center;gap:1px}
.cover b{font-size:11px;font-weight:500}
#rail .ra button,#rail .rt2 button{width:30px;height:30px;border-radius:8px;background:var(--e-chip);color:var(--e-mu)}
#bPlus{position:absolute;z-index:10;right:10px;top:72px;width:44px;height:50px;border:0;border-radius:10px;background:#fff;color:#14141a;font-size:34px;font-weight:300;line-height:1;padding:0;display:grid;place-items:center}
#bPlus:hover{background:#e8e8ec}

/* ---- bottom toolbar ---- */
#side{background:var(--e-bg);border:0;justify-content:flex-start;gap:0;overflow-x:auto;scrollbar-width:none;padding:8px 0 calc(8px + env(safe-area-inset-bottom))}
#side::-webkit-scrollbar{display:none}
#side button{flex:none;max-width:none;min-width:80px;min-height:64px;gap:7px;border-radius:0;background:none;color:var(--e-tx)}
#side button:hover,#side button:active{background:none;color:#fff}
#side small{font-size:14px;color:var(--e-tx);font-weight:400}
#side button.dis{opacity:.38}
#side svg{width:28px;height:28px;stroke-width:1.7}
@media(min-width:900px) and (min-height:560px){
 #side{overflow:hidden auto}#side button{min-width:0}
 #tl{height:260px}
}

/* ---- fixes after first render ---- */
#top{gap:2px;padding-right:10px}
#top .res{font-size:16px;padding:0 30px 0 12px}
#top #bExport.pri{padding:0 16px;font-size:17px;min-height:46px}
.ghost.end{width:100px;padding:0;font-size:16px;gap:6px}
.ghost.end b{font-size:22px}
.mclip{margin:0}
#rail>.rv{gap:26px}
#ph{top:30px}
.trk[data-t=v] .clip{height:100%;top:0;border-radius:8px}
