/* MICC Studio – trình dựng project (editor.js). Nền tối + vàng như studio.css; mọi lớp có tiền tố ed- (và ws-ed / ws-vw cho phần ghép vào màn video). */
.ws-ed{flex:1;min-height:0;display:flex;flex-direction:column;min-width:0}
.ws-ed > .ws-edh,.ws-ed > .ws-plh{flex:1;min-height:0;display:flex;flex-direction:column;min-width:0}
.ws-ed > [hidden]{display:none!important}
.ws-plh > .ws-vwrow{display:flex;align-items:center;gap:8px;padding:0 0 8px;flex:none}
.ws-vw{display:inline-flex;align-items:center;gap:2px;padding:2px;border-radius:9px;border:1px solid rgb(var(--g1) / .22);background:rgb(var(--k0) / .6);flex:none}
.ws-vw button{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:7px;font-size:12px;font-weight:600;color:var(--mut);white-space:nowrap}
.ws-vw button.on{background:rgb(var(--g1) / .16);color:var(--gold-l)}
.ws-vw button:hover:not(.on){color:var(--txt)}

.ed{flex:1;min-height:0;display:flex;flex-direction:column;gap:6px;min-width:0;-webkit-user-select:none;user-select:none;--hw:136px}
.ed [hidden]{display:none!important}
.ed-b{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:32px;height:32px;padding:0 9px;border-radius:8px;border:1px solid rgb(var(--g1) / .16);background:rgb(var(--k1) / .7);color:var(--txt);font-size:12.5px;font-weight:600;white-space:nowrap;transition:border-color .15s,background .15s,color .15s}
.ed-b:hover:not(:disabled){border-color:rgb(var(--g1) / .5);color:var(--gold-l)}
.ed-b:disabled{opacity:.35;cursor:default}
.ed-b.on{background:rgb(var(--g1) / .18);border-color:rgb(var(--g1) / .55);color:var(--gold-l)}
.ed-b.sm{min-width:26px;height:26px;padding:0 6px}
.ed-b i{font-size:13px}
.ed-bar,.ed-ctl{display:flex;align-items:center;gap:6px;flex:none;min-width:0}
.ed-bar{overflow-x:auto;scrollbar-width:none;padding-bottom:1px}
.ed-bar::-webkit-scrollbar{display:none}
.ed-grp{display:inline-flex;gap:4px;padding-left:6px;border-left:1px solid var(--line2)}
.ed-lead:empty{display:none}
.ed-lead + .ed-grp{border-left:0;padding-left:0}
.ed-lead:not(:empty) + .ed-grp{border-left:1px solid var(--line2);padding-left:6px}
.ed-sp{flex:1}
.ed-save{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;color:var(--mut);white-space:nowrap}
.ed-save[data-s="saved"]{color:#7fd49a}.ed-save[data-s="dirty"]{color:var(--gold-l)}.ed-save[data-s="err"],.ed-save[data-s="conflict"]{color:var(--bad)}
.ed-dl{background:linear-gradient(135deg,rgb(var(--g2)),rgb(var(--g4)));color:rgb(var(--ink));border-color:transparent}
.ed-dl:hover:not(:disabled){color:rgb(var(--ink));filter:brightness(1.08)}
.ed-warn{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 10px;border-radius:10px;border:1px solid rgb(248 113 113 / .4);background:rgb(248 113 113 / .08);font-size:12.5px;flex:none}
.ed-warn > span{flex:1;min-width:180px}
.ed-warn > i{color:var(--bad)}

.ed-mid{flex:1;min-height:0;display:flex;gap:8px;min-width:0}
.ed-prev{position:relative;flex:1;min-width:0;min-height:0;display:flex}
.ed-stage{position:relative;flex:1;min-height:0;min-width:0;display:flex;align-items:center;justify-content:center;border-radius:12px;background:#000;overflow:hidden}
.ed-cv{position:relative;overflow:visible;background:#000;flex:none;box-shadow:0 0 0 1px rgb(var(--g1) / .12)}
.ed-player{position:absolute;inset:0;overflow:hidden}
.ed-player > *{width:100%!important;height:100%!important}
.ed-ov{position:absolute;inset:0;z-index:5;cursor:pointer;touch-action:none}
.ed-sel{position:absolute;border:1.5px solid rgb(var(--g2));box-shadow:0 0 0 1px rgb(0 0 0 / .5),0 0 14px rgb(var(--g1) / .35);cursor:move}
.ed-sel.ro{cursor:pointer;border-style:dashed}
.ed-hd{position:absolute;width:14px;height:14px;border-radius:50%;background:rgb(var(--g3));border:2px solid rgb(var(--ink));touch-action:none}
.ed-hd.nw{left:-8px;top:-8px;cursor:nwse-resize}.ed-hd.ne{right:-8px;top:-8px;cursor:nesw-resize}.ed-hd.sw{left:-8px;bottom:-8px;cursor:nesw-resize}.ed-hd.se{right:-8px;bottom:-8px;cursor:nwse-resize}
@media (hover:none){.ed-hd{width:22px;height:22px}.ed-hd.nw{left:-12px;top:-12px}.ed-hd.ne{right:-12px;top:-12px}.ed-hd.sw{left:-12px;bottom:-12px}.ed-hd.se{right:-12px;bottom:-12px}}
.ed-msg{position:absolute;inset:0;z-index:6;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:20px;text-align:center;color:var(--mut);background:rgb(var(--k0) / .85);border-radius:12px}
.ed-msg i{font-size:22px;color:var(--gold)}
/* xem trước dự phòng */
.ed-dom{position:absolute;inset:0;overflow:hidden;container-type:size}
.ed-n{position:absolute;display:block}
.ed-n-clip,.ed-n-image{inset:0;width:100%;height:100%;object-fit:cover;transform-origin:50% 50%}
.ed-n-audio{display:none!important}
.ed-n-text{display:flex;align-items:center;pointer-events:none;white-space:pre-wrap;overflow-wrap:anywhere}
.ed-n-text > span{display:inline;max-width:100%}
.ed-n-graphic{display:flex;align-items:center;justify-content:center;border:1.5px dashed rgb(var(--g1) / .6);background:rgb(var(--g1) / .08);color:var(--gold-l);font-size:12px;font-weight:600}
.ed-n-graphic span{padding:4px 8px;border-radius:6px;background:rgb(0 0 0 / .55)}

/* bảng thuộc tính */
.ed-insp{flex:none;width:300px;min-height:0;display:none;flex-direction:column;border-radius:12px;border:1px solid rgb(var(--g1) / .14);background:rgb(var(--k1) / .75);overflow:hidden}
.ed.insp-open .ed-insp{display:flex}
.ed-ih{display:flex;align-items:center;justify-content:space-between;padding:8px 10px;border-bottom:1px solid var(--line);flex:none}
.ed-ih b{font-size:12.5px;color:var(--gold-l)}
.ed-ih .ed-b i{transform:rotate(-90deg)}
.ed-ib{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:8px 10px 14px;-webkit-user-select:text;user-select:text}
.ed-form{display:grid;grid-template-columns:1fr 1fr;gap:8px 8px;align-items:end}
.ed-gh{grid-column:1/-1;margin-top:6px;padding-top:8px;border-top:1px solid var(--line);font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:rgb(var(--g1) / .85)}
.ed-form > .ed-gh:first-child{margin-top:0;border-top:0;padding-top:0;text-transform:none;letter-spacing:0;font-size:12.5px;color:var(--gold-l)}
.ed-f{display:flex;flex-direction:column;gap:4px;min-width:0}
.ed-f.wide{grid-column:1/-1}
.ed-f > label{font-size:11px;color:var(--mut);font-weight:600}
.ed-f input[type=text],.ed-f input[type=number],.ed-f select,.ed-f textarea{width:100%;min-width:0;height:30px;padding:0 8px;border-radius:7px;border:1px solid var(--line2);background:rgb(var(--k0) / .8);color:var(--txt);font-size:12.5px;outline:none}
.ed-f textarea{height:auto;min-height:64px;padding:6px 8px;resize:vertical;line-height:1.4}
.ed-f input:focus,.ed-f select:focus,.ed-f textarea:focus{border-color:rgb(var(--g1) / .6)}
.ed-f input:disabled,.ed-f select:disabled,.ed-f textarea:disabled{opacity:.6}
.ed-f.rg{display:grid;grid-template-columns:1fr 46px;column-gap:8px}
.ed-f.rg > label{grid-column:1/-1}
.ed-f.rg output{font-size:11.5px;color:var(--gold-l);text-align:right;font-variant-numeric:tabular-nums}
.ed-f input[type=range]{width:100%;accent-color:rgb(var(--g1));height:20px}
.ed-col{display:flex;gap:4px;align-items:center}
.ed-col input[type=color]{width:30px;height:30px;padding:0;border:1px solid var(--line2);border-radius:7px;background:none;flex:none;cursor:pointer}
.ed-col .hx{flex:1}
.ed-chk{display:flex;align-items:center;gap:7px;min-height:30px;font-size:12.5px;cursor:pointer}
.ed-chk input{accent-color:rgb(var(--g1));width:15px;height:15px}
.ed-seg{display:inline-flex;gap:2px;padding:2px;border-radius:8px;border:1px solid var(--line2);background:rgb(var(--k0) / .8);height:30px}
.ed-seg button{flex:1;min-width:28px;border-radius:6px;color:var(--mut)}
.ed-seg button.on{background:rgb(var(--g1) / .2);color:var(--gold-l)}
.ed-pair{display:flex;gap:4px}.ed-pair select{flex:1}.ed-pair input{width:58px!important;flex:none}
.ed-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:18px 6px;color:var(--mut);font-size:12.5px}
.ed-empty > i{font-size:22px;color:rgb(var(--g1) / .7)}
.ed-empty p{margin:0}
.ed-empty .mut{font-size:11.5px}
.ed-empty dl{display:grid;grid-template-columns:auto auto;gap:4px 14px;margin:6px 0 0;font-size:12px}
.ed-empty dt{color:var(--mut);text-align:right}.ed-empty dd{margin:0;color:var(--txt);text-align:left;font-variant-numeric:tabular-nums}

/* điều khiển + timeline */
.ed-time{font-size:12px;color:var(--mut);margin-left:4px;white-space:nowrap}
.ed-play{width:38px;border-radius:50%;padding:0;background:rgb(var(--g1) / .16);border-color:rgb(var(--g1) / .5);color:var(--gold-l)}
.ed-tl{flex:none;height:clamp(150px,30%,250px);border-radius:12px;border:1px solid rgb(var(--g1) / .14);background:rgb(var(--k0) / .75);overflow:hidden;position:relative}
.ed-sc{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y}
.ed-in{position:relative;min-height:100%}
.ed-rr{position:sticky;top:0;z-index:6;display:flex;height:22px}
.ed-corner{position:sticky;left:0;z-index:7;width:var(--hw);flex:none;background:rgb(var(--k1));border-bottom:1px solid var(--line);border-right:1px solid var(--line)}
.ed-ruler{position:relative;flex:none;height:22px;background:rgb(var(--k1));border-bottom:1px solid var(--line);cursor:ew-resize;touch-action:none}
.ed-ruler span{position:absolute;top:0;height:100%;padding:4px 0 0 4px;border-left:1px solid var(--line2);font-size:10px;color:var(--mut);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none}
.ed-row{display:flex;height:40px;border-bottom:1px solid var(--line)}
.ed-row.k-video{height:48px}
.ed-th{position:sticky;left:0;z-index:4;width:var(--hw);flex:none;display:flex;align-items:center;gap:6px;padding:0 6px 0 8px;background:rgb(var(--k1));border-right:1px solid var(--line);min-width:0}
.ed-th .ki{font-size:11px;color:rgb(var(--g1) / .8);flex:none}
.ed-th .tn{flex:1;min-width:0;font-size:11.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ed-th .tb{display:flex;gap:1px;flex:none}
.ed-th .tb button{width:20px;height:22px;border-radius:5px;font-size:10px;color:var(--fnt)}
.ed-th .tb button:hover{color:var(--txt)}
.ed-th .tb button.on{color:var(--gold-l)}
.ed-row.hid .ed-lane{opacity:.4}
.ed-row.lock .ed-lane{background-image:repeating-linear-gradient(135deg,rgb(255 255 255 / .025) 0 6px,transparent 6px 12px)}
.ed-lane{position:relative;flex:none;height:100%}
.ed-it{position:absolute;top:4px;bottom:4px;display:flex;align-items:center;border-radius:6px;overflow:hidden;cursor:grab;font-size:11px;font-weight:600;color:#fff;border:1px solid rgb(255 255 255 / .18);touch-action:pan-x pan-y}
.ed-it span{flex:1;min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;text-shadow:0 1px 2px rgb(0 0 0 / .6)}
.ed-it.t-clip{background:linear-gradient(180deg,#3a5a86,#2a4266)}
.ed-it.t-image{background:linear-gradient(180deg,#6a4f8e,#4d3870)}
.ed-it.t-text{background:linear-gradient(180deg,rgb(var(--g5)),rgb(var(--g4)));color:rgb(var(--ink))}
.ed-it.t-text span{text-shadow:none}
.ed-it.t-graphic{background:linear-gradient(180deg,#9a4f78,#73395a)}
.ed-it.t-audio{background:linear-gradient(180deg,#2f7a5c,#225a44)}
.ed-it.sel{border-color:rgb(var(--g3));box-shadow:0 0 0 2px rgb(var(--g2)),0 0 12px rgb(var(--g1) / .45);z-index:2;touch-action:none}
.ed-row.lock .ed-it{cursor:default}
.ed-it .eh{position:absolute;top:0;bottom:0;width:8px;z-index:1;cursor:ew-resize}
.ed-it .eh.l{left:0}.ed-it .eh.r{right:0}
.ed-it.sel .eh{background:rgb(var(--g3) / .85)}
.ed-it.sel .eh::after{content:"";position:absolute;left:50%;top:30%;bottom:30%;width:2px;margin-left:-1px;border-radius:1px;background:rgb(var(--ink) / .7)}
.ed-ph{position:absolute;top:0;bottom:0;width:0;z-index:5;pointer-events:none}
.ed-ph::before{content:"";position:absolute;top:0;bottom:0;left:-1px;width:2px;background:#ff5a5a;box-shadow:0 0 6px rgb(255 90 90 / .6)}
.ed-ph i{position:absolute;top:0;left:-7px;width:14px;height:18px;background:#ff5a5a;clip-path:polygon(0 0,100% 0,100% 60%,50% 100%,0 60%);pointer-events:auto;cursor:ew-resize;touch-action:none}
.ed-menu{position:fixed;z-index:9999;min-width:220px;padding:6px;border-radius:12px;border:1px solid rgb(var(--g1) / .25);background:rgb(var(--k2));box-shadow:0 18px 50px rgb(0 0 0 / .55);display:flex;flex-direction:column;gap:2px;animation:wsIn .12s ease both}
.ed-menu button{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;text-align:left;font-size:12.5px;color:var(--txt)}
.ed-menu button:hover{background:rgb(var(--g1) / .12);color:var(--gold-l)}
.ed-menu button i{width:16px;text-align:center;color:rgb(var(--g1))}
.ed-menu button span{display:flex;flex-direction:column}
.ed-menu small{font-size:11px;color:var(--mut);font-weight:500}
.ed[data-ro="1"] [data-a="undo"],.ed[data-ro="1"] [data-a="redo"],.ed[data-ro="1"] .ed-grp:has([data-a="split"]),.ed[data-ro="1"] .ed-grp:has([data-a="text"]){display:none}

/* màn vừa (laptop nhỏ) */
@media (max-width:1250px){.ed-insp{width:260px}.ed-bar .ed-grp .ed-b > span{display:none}}
/* điện thoại / màn hẹp: xem trước trên, timeline dưới, bảng thuộc tính mở thành tấm dưới đáy (người dùng tự thu / mở) */
@media (max-width:900px){
  .ed{gap:5px;--hw:64px}
  .ed-bar,.ed-ctl{gap:4px}
  .ed-grp{gap:3px;padding-left:4px}
  .ed-bar > .ed-sp{display:none}
  .ed-ctl [data-a="zin"],.ed-ctl [data-a="zout"]{display:none}   /* điện thoại: phóng to / thu nhỏ timeline bằng 2 ngón */
  .ed-save span{display:none}
  .ed-time{font-size:11px;margin-left:0}
  .ed-b{min-width:33px;height:34px;padding:0 7px}
  .ed-b > span{display:none}
  .ed-mid{flex:none;flex-direction:column;gap:5px}
  .ed-prev{flex:none;height:25dvh;min-height:130px}
  .ed-insp{position:fixed;left:0;right:0;bottom:0;z-index:60;width:auto;max-height:56dvh;border-radius:16px 16px 0 0;border-width:1px 0 0;box-shadow:0 -14px 40px rgb(0 0 0 / .6);background:rgb(var(--k1))}
  .ed:not(.has-sel) .ed-insp{display:none!important}
  .ed-ib{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  .ed-ih .ed-b i{transform:none}
  .ed-tl{height:116px}
  .ed-th .tn{display:none}
  .ed-th{gap:2px;padding:0 3px;justify-content:center}
  .ed-th .ki{display:none}
  .ed-th .tb button{width:19px}
  .ed-row{height:32px}.ed-row.k-video{height:38px}
  .ed-it .eh{width:12px}
  .ws-vw button{height:30px;padding:0 8px}
  .ws-vw button span{display:none}
  .ws-ed .ed-f input[type=text],.ws-ed .ed-f input[type=number],.ws-ed .ed-f select,.ws-ed .ed-f textarea{font-size:16px;height:36px}
  .ws-ed .ed-f textarea{height:auto}
  /* màn video trên điện thoại: phần dựng cao theo nội dung (không bị khung 27dvh của trình phát cũ ép) */
  .ws:not([data-mode="compose"]):not([data-mode="load"]) .ws-body:has(.ws-ed){padding:6px 8px 0!important}
}
