/* AI editor page (#/editor, assets/editor.js): a CapCut-style editor.
   Media bin | player | AI chat, timeline underneath. Tokens from styles.css. */

/* ---------- page frame: the editor fills the window on desktop ---------- */
.ed-app {
  --ed-bin: 208px; --ed-chat: 336px; --ed-tl: 250px;
  --panel: var(--bg-2); --panel-2: var(--surface); --wave: rgba(196, 191, 178, 0.55);
  --cut: #f2665a; --gfx: #8fb3ff; --fx: var(--accent);
  display: grid; gap: 6px; min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "bar" "stage" "tl" "chat" "bin";
}
@media (prefers-color-scheme: light) { .app-body .ed-app { --wave: rgba(69, 67, 59, 0.5); --cut: #be3328; --gfx: #2f5bd3; --fx: #4b6400; } }
.ed-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 0; min-height: 0; }
.ed-mode .view { padding-top: 10px; }
.ed-mode .view-enter { animation: none; }

@media (min-width: 1024px) {
  .ed-mode .main-col { height: 100dvh; overflow: hidden; }
  .ed-mode .view { flex: 1 1 0; min-height: 0; max-width: none; padding: 8px; display: flex; }
  .ed-app {
    flex: 1; min-height: 0; height: 100%;
    grid-template-columns: var(--ed-bin) minmax(0, 1fr) var(--ed-chat);
    grid-template-rows: 44px minmax(0, 1fr) var(--ed-tl);
    grid-template-areas: "bar bar bar" "bin stage chat" "tl tl chat";
  }
}
@media (min-width: 1360px) { .ed-app { --ed-bin: 236px; --ed-chat: 380px; } }
@media (min-width: 1024px) and (max-height: 760px) { .ed-app { --ed-tl: 226px; } .ed-heads, .ed-lanes { grid-template-rows: 22px 42px 26px 18px 18px 18px; } .ed-rng { height: 46px; } .ed-dim { height: 73px; } }

/* ---------- top bar ---------- */
.ed-bar { grid-area: bar; display: flex; align-items: center; gap: 12px; padding: 0 6px 0 12px; min-height: 44px; }
.ed-proj { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.ed-proj-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.ed-proj-ic svg { width: 15px; height: 15px; }
.ed-proj b { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: -0.01em; font-stretch: 105%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-proj .mono { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ed-bar-r { display: flex; align-items: center; gap: 10px; flex: none; }
.ed-save { display: none; align-items: center; gap: 7px; font-size: 12px; }
.ed-save.on { display: inline-flex; color: var(--accent-text); }
.ed-save.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-text); animation: pulse 1.6s ease-in-out infinite; }
.ed-exp-btn { height: 32px; padding: 0 12px; gap: 7px; }
.ed-exp-btn:not(.ed-ready) { --b-bg: var(--surface-2); --b-fg: var(--text); --b-line: var(--line-2); }
.ed-exp-btn:not(.ed-ready):hover { background: var(--surface-3); border-color: var(--line-3); }

/* ---------- popovers ---------- */
.ed-popwrap { position: relative; }
.ed-pop { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; width: 280px; max-width: calc(100vw - 32px); padding: 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-float); display: grid; gap: 2px; animation: ed-pop .16s var(--ease-out); }
.ed-pop[hidden] { display: none; }
.ed-pop-r { left: auto; right: 0; }
.ed-pop-up { top: auto; bottom: calc(100% + 8px); }
.ed-pop-c { left: 50%; transform: translateX(-50%); animation: none; }
@keyframes ed-pop { from { opacity: 0; transform: translateY(-4px); } }
.ed-pop-h { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 8px 6px; }
.ed-pop-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: 500 13px var(--font); cursor: pointer; text-decoration: none; min-width: 0; }
.ed-pop-item:hover { background: var(--hover); }
.ed-pop-item > svg { width: 17px; height: 17px; color: var(--accent-text); flex: none; }
.ed-pop-item > span { display: grid; gap: 1px; min-width: 0; flex: 1; }
.ed-pop-item > span > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-pop-item b { font-weight: 600; }
.ed-pop-item .muted { font-size: 11.5px; }
.ed-pop-list .ed-pop-item { justify-content: space-between; }
.ed-pop-list .ed-pop-item > span { display: block; flex: 0 1 auto; }
.ed-pop-list { max-height: 260px; overflow: auto; display: grid; gap: 1px; }
.ed-pop-none { margin: 0; padding: 4px 8px 8px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.ed-pop-acts { padding: 0 8px 8px; display: flex; gap: 8px; }

/* ---------- media bin ---------- */
.ed-bin { grid-area: bin; display: flex; flex-direction: column; overflow: hidden; }
.ed-ph { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; font-size: 12.5px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--line); flex: none; }
.ed-ph .mono { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 500; }
.ed-bin-top { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 10px 4px; }
.ed-add { display: flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 13.5px; cursor: pointer; transition: background-color .15s, transform .15s var(--ease); user-select: none; }
.ed-add:hover { background: var(--accent-hover); }
.ed-add:active { transform: translateY(1px); }
.ed-add svg { width: 17px; height: 17px; }
.ed-fromclips { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.ed-fromclips:hover { background: var(--hover); color: var(--text); }
.ed-fromclips svg { width: 16px; height: 16px; }
.ed-bin .ed-clip-pop { left: auto; right: 0; }
.ed-bin-grid { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px 8px; align-content: start; }
.ed-bin-none { grid-column: 1 / -1; margin: 6px 2px; font-size: 12.5px; color: var(--muted); }
.ed-tile { display: grid; gap: 5px; cursor: pointer; min-width: 0; outline: none; }
.ed-tile-img { position: relative; aspect-ratio: 16 / 10; border-radius: 7px; overflow: hidden; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .12s; }
.ed-tile-img canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.ed-tile:hover .ed-tile-img { box-shadow: inset 0 0 0 1px var(--line-3); }
.ed-tile.on .ed-tile-img { box-shadow: 0 0 0 2px var(--accent); }
.ed-tile:focus-visible .ed-tile-img { box-shadow: 0 0 0 2px var(--accent-text); }
.ed-tile-name { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 1px; }
.ed-tile.on .ed-tile-name { color: var(--text); }
.ed-tile-dur { position: absolute; right: 4px; bottom: 4px; padding: 1px 4px; border-radius: 4px; background: rgba(8, 8, 6, .72); color: #f0ece2; font-size: 10px; }
.ed-tile-kind, .ed-tile-st { position: absolute; left: 4px; top: 4px; padding: 1px 5px; border-radius: 4px; background: rgba(8, 8, 6, .72); color: #c4bfb2; font: 500 9.5px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.ed-tile-st { left: auto; right: 4px; }
.ed-tile-st.done { background: var(--accent); color: var(--accent-ink); }
.ed-tile-st.run { color: #cef047; }
.ed-tile-kind + .ed-tile-st { top: 4px; }
.ed-tile-x { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 6px; border: 0; display: grid; place-items: center; background: rgba(8, 8, 6, .78); color: #f0ece2; cursor: pointer; opacity: 0; transition: opacity .12s; }
.ed-tile-x svg { width: 13px; height: 13px; }
.ed-tile:hover .ed-tile-x, .ed-tile:focus-within .ed-tile-x, .ed-tile.up .ed-tile-x { opacity: 1; }
.ed-tile:hover .ed-tile-st { opacity: 0; }
@media (hover: none) { .ed-tile-x { opacity: .9; } .ed-tile-st { display: none; } }
.ed-tile-up { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; justify-items: center; background: rgba(8, 8, 6, .62); color: #f0ece2; font-size: 11px; }
.ed-tile-bar { width: 64px; height: 4px; border-radius: 4px; background: rgba(240, 236, 226, .2); overflow: hidden; }
.ed-tile-bar i { display: block; height: 100%; background: #cef047; border-radius: 4px; transition: width .2s; }

/* ---------- player ---------- */
.ed-stage { grid-area: stage; display: flex; flex-direction: column; overflow: hidden; }
.ed-screen { position: relative; flex: 1; min-height: 0; background: #050504; display: grid; place-items: center; overflow: hidden; border-radius: 9px 9px 0 0; }
.ed-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: #050504; cursor: pointer; }
.ed-screen video[hidden] { display: none; }
.ed-screen:fullscreen video { cursor: default; }
.ed-tag { position: absolute; left: 10px; top: 10px; padding: 4px 8px; border-radius: 6px; background: rgba(8, 8, 6, .7); color: #c4bfb2; font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; pointer-events: none; backdrop-filter: blur(8px); }
.ed-tag.edit { color: #10130a; background: #cef047; }
.ed-hero { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: radial-gradient(120% 90% at 50% 40%, #151512 0%, #0a0a08 70%); }
.ed-hero[hidden] { display: none; }
.ed-hero-in { width: min(460px, 100%); display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 24px 28px; border: 1.5px dashed rgba(240, 236, 226, .16); border-radius: 16px; }
.ed-hero-btn { display: inline-flex; align-items: center; gap: 12px; height: 60px; padding: 0 30px 0 22px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: -0.015em; font-stretch: 110%; cursor: pointer; box-shadow: 0 18px 40px -18px rgba(206, 240, 71, .55); transition: transform .15s var(--ease), background-color .15s; }
.ed-hero-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.ed-hero-plus { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(16, 19, 10, .12); }
.ed-hero-plus svg { width: 20px; height: 20px; }
.ed-hero-in p { margin: 4px 0 0; color: #c4bfb2; font-size: 14px; }
.ed-hero-in .hint { color: #8c877b; }
.ed-link { border: 0; background: none; padding: 4px; color: #cef047; font: 600 13px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(206, 240, 71, .4); }
.ed-link:hover { text-decoration-color: currentColor; }
.ed-dropcover { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 12px; background: rgba(8, 8, 6, .8); border: 2px dashed #cef047; color: #f0ece2; font-family: var(--display); font-size: 22px; font-weight: 800; pointer-events: none; }
.ed-dropcover[hidden] { display: none; }
.ed-dropcover span { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: #cef047; color: #10130a; }
.ed-dropcover svg { width: 26px; height: 26px; }

.ed-ctrl { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px; border-top: 1px solid var(--line); flex: none; min-width: 0; }
.ed-ctrl.off { opacity: .4; pointer-events: none; }
.ed-ib { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .12s, color .12s; }
.ed-ib:hover { background: var(--hover); color: var(--text); }
.ed-ib svg { width: 18px; height: 18px; }
.ed-ib.ed-play { width: 34px; height: 34px; border-radius: 50%; background: var(--text); color: var(--bg); }
.ed-ib.ed-play:hover { background: var(--accent); color: var(--accent-ink); }
.ed-ib.ed-play svg { width: 16px; height: 16px; }
.ed-time { font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; }
.ed-time b { color: var(--text); font-weight: 500; }
.ed-scrub { -webkit-appearance: none; appearance: none; flex: 1; min-width: 40px; height: 18px; background: transparent; cursor: pointer; --p: 0%; }
.ed-scrub::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--text-2) var(--p), var(--surface-3) var(--p)); }
.ed-scrub::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--text-2) var(--p), var(--surface-3) var(--p)); }
.ed-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); margin-top: -4px; border: 0; }
.ed-scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; }
.ed-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.ed-seg[hidden] { display: none; }
.ed-seg button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font: 600 12px var(--font); cursor: pointer; white-space: nowrap; }
.ed-seg button:hover { color: var(--text); }
.ed-seg button.on { background: var(--text); color: var(--bg); }
.ed-ab button[data-v="edit"].on { background: var(--accent); color: var(--accent-ink); }
.ed-ab.pulse { animation: ed-glow 1.6s var(--ease-out) 2; }
@keyframes ed-glow { 50% { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent-line); } }

/* ---------- timeline ---------- */
.ed-tl { grid-area: tl; display: flex; flex-direction: column; overflow: hidden; }
.ed-tl-h { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; flex: none; min-width: 0; }
.ed-rng-txt { display: flex; align-items: center; gap: 10px; min-width: 0; white-space: nowrap; overflow: hidden; }
.ed-rng-txt b { font-weight: 600; color: var(--text); }
.ed-rng-txt .mono { font-size: 11.5px; }
.ed-mini { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 600 11.5px var(--font); cursor: pointer; flex: none; }
.ed-mini[hidden] { display: none; }
.ed-mini:hover { background: var(--hover); color: var(--text); }
.ed-mini svg { width: 13px; height: 13px; }
.ed-legend { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ed-legend i { margin-left: 8px; }
.lg-cut, .lg-gfx, .lg-fx, .lg-who { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; }
.lg-cut { background: var(--cut); }
.lg-gfx { background: var(--gfx); }
.lg-fx { background: var(--fx); }
.lg-who { background: var(--text-2); border-radius: 50%; }
.ed-tl-b { flex: 1; min-height: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr); overflow-y: auto; overflow-x: hidden; padding: 6px 0 8px; }
.ed-heads, .ed-lanes { display: grid; grid-template-rows: 22px 50px 30px 20px 20px 20px; row-gap: 5px; }
.ed-heads span { display: grid; place-items: center; color: var(--faint); }
.ed-heads svg { width: 14px; height: 14px; }
.ed-lanes { position: relative; margin-right: 14px; cursor: text; touch-action: none; user-select: none; -webkit-user-select: none; }
.ed-lanes.dragging { cursor: ew-resize; }
.ed-ruler { width: 100%; height: 22px; display: block; }
.ed-lane { position: relative; border-radius: 6px; background: var(--surface); overflow: hidden; }
.ed-lane canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ed-lane-v { background: var(--surface-3); }
#edShade i { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(8, 8, 6, .72) 0 5px, rgba(242, 102, 90, .38) 5px 7px); box-shadow: inset 1px 0 0 var(--cut), inset -1px 0 0 var(--cut); }
.ed-lane-a { background: color-mix(in srgb, var(--surface) 70%, var(--surface-3)); }
.ed-trk { background: transparent; box-shadow: inset 0 0 0 1px var(--line); overflow: visible; }
.ed-trk-note { position: absolute; left: 10px; top: 0; line-height: 20px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.ed-blk { position: absolute; top: 0; bottom: 0; border-radius: 4px; padding: 0 6px; font: 500 10.5px/18px var(--font); white-space: nowrap; overflow: hidden; cursor: pointer; min-width: 3px; }
.ed-blk span { display: block; overflow: hidden; text-overflow: ellipsis; }
.ed-blk.cuts { background: color-mix(in srgb, var(--cut) 26%, transparent); border: 1px solid color-mix(in srgb, var(--cut) 70%, transparent); color: var(--text); padding: 0 3px; }
.ed-blk.gfx { background: color-mix(in srgb, var(--gfx) 24%, transparent); border: 1px solid color-mix(in srgb, var(--gfx) 65%, transparent); color: var(--text); }
.ed-blk.fx { background: color-mix(in srgb, var(--fx) 20%, transparent); border: 1px solid color-mix(in srgb, var(--fx) 60%, transparent); color: var(--text); }
.ed-blk:hover { filter: brightness(1.2); z-index: 2; }
.ed-blk.cuts.restored { background: transparent; border-style: dashed; color: var(--muted); }
.ed-dim { position: absolute; top: 27px; height: 85px; background: rgba(5, 5, 4, .62); pointer-events: none; z-index: 3; }
.ed-dim[hidden] { display: none; }
.ed-dim-l { left: 0; }
.ed-dim-r { right: 0; }
.ed-rng { position: absolute; top: 25px; height: 54px; border: 2px solid var(--text-2); border-radius: 7px; z-index: 4; pointer-events: none; box-sizing: border-box; }
.ed-rng.part { border-color: var(--accent); }
.ed-rng[hidden] { display: none; }
.ed-hdl { position: absolute; top: -2px; bottom: -2px; width: 12px; background: var(--text-2); pointer-events: auto; cursor: ew-resize; display: grid; place-items: center; }
.ed-rng.part .ed-hdl { background: var(--accent); }
.ed-hdl::after { content: ""; width: 2px; height: 16px; border-radius: 2px; background: rgba(8, 8, 6, .55); }
.ed-hdl[data-h="0"] { left: -2px; border-radius: 7px 0 0 7px; }
.ed-hdl[data-h="1"] { right: -2px; border-radius: 0 7px 7px 0; }
.ed-head { position: absolute; top: 0; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); z-index: 6; pointer-events: none; box-shadow: 0 0 0 1px rgba(8, 8, 6, .35); }
.ed-head[hidden] { display: none; }
.ed-head::before { content: ""; position: absolute; top: 0; left: -5px; width: 12px; height: 14px; background: var(--text); clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.ed-tl-empty { position: absolute; inset: 27px 0 0; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; z-index: 5; }
.ed-tl-empty[hidden] { display: none; }
.ed-tl.off .ed-trk, .ed-tl.off .ed-lane { opacity: .5; }

/* ---------- AI chat ---------- */
.ed-chat { grid-area: chat; display: flex; flex-direction: column; overflow: hidden; }
.ed-chat-h { gap: 9px; color: var(--text); }
.ed-chat-h .ed-mini { margin-left: auto; }
.ed-ai-dot { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); position: relative; flex: none; }
.ed-ai-dot::after { content: ""; position: absolute; inset: 5px; border-radius: 2px; background: var(--accent-ink); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.ed-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; overscroll-behavior: contain; }
.m { display: flex; gap: 9px; min-width: 0; animation: ed-msg .25s var(--ease-out); }
@keyframes ed-msg { from { opacity: 0; transform: translateY(4px); } }
.m-av { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); flex: none; position: relative; margin-top: 1px; }
.m-av::after { content: ""; position: absolute; inset: 6px 5px 6px 7px; background: var(--accent-ink); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.m-body { min-width: 0; flex: 1; display: grid; gap: 9px; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.m-body p { margin: 0; }
.m-sub { font-size: 12px; color: var(--muted); line-height: 1.45; }
.m.old .m-body { opacity: .62; }
.m.old .m-list, .m.old .m-adv { display: none; }
.m-me { justify-content: flex-end; }
.m-me .m-body { flex: 0 1 auto; max-width: 86%; background: var(--surface-3); padding: 8px 12px; border-radius: 12px 12px 4px 12px; }
.m-me.act .m-body { background: transparent; padding: 0; }
.m-act { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 6px 9px; border: 1px solid var(--line-2); border-radius: 99px; }
.m-plan-h { display: flex; align-items: center; gap: 8px; }
.m-plan-h b { font-family: var(--display); font-weight: 800; font-size: 14.5px; letter-spacing: -0.01em; font-stretch: 105%; }
.m-list { display: grid; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.m-sec { display: grid; gap: 4px; }
.m-sec-h { display: flex; align-items: center; gap: 7px; font: 500 10.5px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.m-sec-h .mono { color: var(--muted); }
.m-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.m-sec li { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.m-sec li > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.m-sec li b { color: var(--text); font-weight: 600; }
.m-sec li.more { color: var(--muted); font-size: 12px; padding-left: 2px; }
.m-t { border: 0; background: none; padding: 0; font-size: 11.5px; color: var(--accent-text); cursor: pointer; flex: none; min-width: 52px; text-align: left; }
.m-t:hover { text-decoration: underline; }
span.m-t { cursor: default; color: var(--text-2); }
span.m-t:hover { text-decoration: none; }
.m-sec li .mono.muted { font-size: 11px; flex: none; }
.m-id { font-size: 11px; color: var(--accent-text); flex: none; }
.m-stat { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.m-stat .mono { color: var(--text); font-size: 13px; }
.m-arrow { width: 16px; height: 1px; background: var(--muted); position: relative; }
.m-arrow::after { content: ""; position: absolute; right: 0; top: -3px; border: 3.5px solid transparent; border-left-color: var(--muted); border-right: 0; }
.skeleton-lines { display: grid; gap: 8px; }
.skeleton-lines i { height: 10px; border-radius: 5px; background: var(--surface-3); animation: pulse 1.4s ease-in-out infinite; }
.skeleton-lines i:nth-child(2) { width: 80%; } .skeleton-lines i:nth-child(3) { width: 60%; }
.m-adv summary { cursor: pointer; font-size: 12px; color: var(--text-2); font-weight: 500; width: max-content; }
.m-adv summary:hover { color: var(--text); }
.m-adv[open] { display: grid; gap: 8px; }
.m-pre { margin: 0; max-height: 220px; overflow: auto; padding: 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: 11px/1.55 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.m-json { width: 100%; min-height: 160px; padding: 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 11.5px; line-height: 1.5; resize: vertical; outline: none; }
.m-json:focus { border-color: var(--accent-line); }
.m-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.m-acts .btn { height: 34px; }
.m-acts .btn svg { width: 15px; height: 15px; }
.m-free, .m-cost { font: 500 10.5px/1 var(--mono); padding: 3px 5px; border-radius: 4px; margin-left: 2px; background: var(--accent-soft); color: var(--accent-text); }
.btn-primary .m-cost, .btn-primary .m-free { background: rgba(0, 0, 0, .14); color: inherit; }
.m-prog { display: grid; gap: 7px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.m-prog-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; }
.m-prog-row b { font-weight: 600; }
.m-prog-row .mono { font-size: 11.5px; color: var(--accent-text); }
.m-bar { height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; position: relative; }
.m-bar i { display: block; height: 100%; border-radius: 5px; background: var(--accent); transition: width .6s var(--ease-out); position: relative; overflow: hidden; }
.m-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: ed-sheen 1.6s ease-in-out infinite; }
.m-bar.wait i { background: var(--line-3); }
@keyframes ed-sheen { to { transform: translateX(100%); } }
.m-stage { font-size: 11.5px; color: var(--muted); }
.m-err { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); font-size: 12.5px; }
.m-err b { color: var(--danger); font-weight: 600; }
.m-err span { color: var(--text-2); }
.m-warn { padding: 9px 11px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; }
.m-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: #050504; padding: 0; cursor: pointer; }
.m-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.m-frame .skeleton { position: absolute; inset: 0; }
.m-frame-play { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%; display: grid; place-items: center; background: rgba(8, 8, 6, .62); color: #f0ece2; backdrop-filter: blur(6px); transition: transform .15s var(--ease), background-color .15s; }
.m-frame-play svg { width: 18px; height: 18px; margin-left: 2px; }
.m-frame:hover .m-frame-play { transform: scale(1.08); background: #cef047; color: #10130a; }
.m-frame-tag { position: absolute; left: 8px; bottom: 8px; padding: 3px 6px; border-radius: 5px; background: rgba(8, 8, 6, .7); color: #c4bfb2; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.m-tg { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.m-tg li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.m-tg .badge { height: 19px; font-size: 10.5px; margin-left: auto; }
.m-ids { display: flex; flex-wrap: wrap; gap: 6px; }
.m-idb { min-width: 34px; height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 12.5px; cursor: pointer; transition: border-color .12s, background-color .12s; }
.m-idb:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.m-idb.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.ed-foot { flex: none; padding: 8px 10px 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; background: var(--panel); }
.ed-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; padding: 0 10px; mask-image: linear-gradient(90deg, #000 88%, transparent); }
.ed-chips::-webkit-scrollbar { display: none; }
.ed-chips.off { opacity: .45; pointer-events: none; }
.ed-chip { flex: none; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 500 12px var(--font); cursor: pointer; white-space: nowrap; transition: border-color .12s, color .12s, background-color .12s; }
.ed-chip:hover { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.ed-comp { position: relative; display: grid; gap: 4px; padding: 8px 8px 6px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.ed-comp:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-comp textarea { width: 100%; min-height: 24px; max-height: 160px; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font: 400 14px/1.5 var(--font); padding: 2px 0; }
.ed-comp textarea::placeholder { color: var(--faint); }
.ed-comp textarea:disabled { cursor: not-allowed; }
.ed-comp-row { display: flex; align-items: center; gap: 6px; margin-left: -6px; min-width: 0; }
.ed-opt-btn { width: 30px; height: 30px; }
.ed-opt-sum { display: flex; gap: 4px; min-width: 0; overflow: hidden; flex: 1; }
.ed-opt-sum span { font: 500 10.5px/1 var(--mono); color: var(--muted); padding: 4px 6px; border-radius: 5px; background: var(--surface-2); white-space: nowrap; }
.ed-send { width: 32px; height: 32px; border-radius: 9px; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); cursor: pointer; flex: none; transition: background-color .15s, transform .15s var(--ease); }
.ed-send:hover { background: var(--accent-hover); }
.ed-send:active { transform: scale(.95); }
.ed-send[disabled] { background: var(--surface-3); color: var(--faint); cursor: not-allowed; }
.ed-send svg { width: 17px; height: 17px; }
.ed-send .spinner { width: 14px; height: 14px; }
.ed-fresh { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--accent-text); }
.ed-fresh[hidden] { display: none; }
.ed-fresh .ed-mini { height: 20px; padding: 0 4px; border: 0; }
.ed-comp .ed-pop { left: -6px; width: 300px; }
.ed-opt { display: grid; gap: 6px; padding: 6px 8px 10px; }
.ed-opt + .ed-opt { border-top: 1px solid var(--line); padding-top: 10px; }
.ed-lbl { font-size: 12px; font-weight: 600; color: var(--text); }
.ed-opt .hint { font-size: 11.5px; line-height: 1.45; }
.ed-opt .ed-seg { width: max-content; }
.ed-ref { width: max-content; max-width: 100%; overflow: hidden; }
.ed-ref span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-ref-on { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.ed-ref-on svg { width: 16px; height: 16px; color: var(--accent-text); }
.ed-ref-on .ed-mini { margin-left: auto; border: 0; }

/* ---------- coming soon ---------- */
.ed-soon { max-width: 560px; display: grid; gap: 10px; justify-items: start; }
.ed-soon h2 { margin: 0; font-family: var(--display); font-weight: 800; }
.ed-soon p { margin: 0; line-height: 1.55; }

/* ---------- phone and small tablet: one column ---------- */
@media (max-width: 1023px) {
  .ed-app { grid-template-areas: "bar" "bin" "stage" "tl" "chat"; gap: 8px; }
  .ed-bar { padding: 0 6px 0 10px; }
  .ed-proj .mono { display: none; }
  .ed-bin { flex-direction: row; align-items: stretch; }
  .ed-bin .ed-ph { display: none; }
  .ed-bin-top { display: flex; flex-direction: column; padding: 8px; gap: 6px; flex: none; }
  .ed-add { width: 76px; height: auto; flex: 1; flex-direction: column; gap: 3px; font-size: 11.5px; border-radius: 8px; }
  .ed-fromclips { width: 76px; height: 26px; justify-content: center; padding: 0; font-size: 11px; }
  .ed-fromclips svg { display: none; }
  .ed-bin .ed-clip-pop { left: 0; right: auto; }
  .ed-bin-grid { display: flex; overflow-x: auto; overflow-y: hidden; gap: 8px; padding: 8px 8px 8px 0; scrollbar-width: none; }
  .ed-bin-grid::-webkit-scrollbar { display: none; }
  .ed-tile { width: 104px; flex: none; }
  .ed-bin-none { align-self: center; margin: 0 4px; }
  .ed-stage { overflow: visible; }
  .ed-screen { aspect-ratio: 16 / 10; flex: none; max-height: 62vh; }
  .ed-hero-in { padding: 22px 16px; border: 0; gap: 8px; }
  .ed-hero-btn { height: 54px; font-size: 17px; }
  .ed-ctrl { gap: 6px; padding: 0 6px; }
  .ed-hide-s { display: none !important; }
  .ed-tl-b { padding-bottom: 10px; }
  .ed-legend { display: none; }
  .ed-heads { display: none; }
  .ed-tl-b { grid-template-columns: minmax(0, 1fr); }
  .ed-lanes { margin: 0 10px; }
  .ed-chat { min-height: 360px; }
  .ed-thread { max-height: 70vh; }
  .ed-pop { width: min(300px, calc(100vw - 32px)); }
}
@media (max-width: 480px) {
  .ed-time span:not(#edDur) { display: inline; }
  .ed-scrub { display: none; }
  .ed-ctrl .ed-ab { margin-left: auto; }
  .ed-seg button { padding: 0 8px; }
}

/* "Your clips" list: on desktop span the Media panel's toolbar instead of
   hanging off the panel's left edge (the panel clips overflow); on phones let
   it escape the short bin strip. */
@media (min-width: 1024px) {
  .ed-bin-top { position: relative; }
  .ed-bin .ed-bin-top .ed-popwrap { position: static; }
  .ed-bin .ed-bin-top .ed-clip-pop { left: 10px; right: 10px; width: auto; max-width: none; }
}
@media (max-width: 1023px) {
  .ed-bin { overflow: visible; position: relative; z-index: 5; }
}
.ed-bin .ed-clip-pop .ed-pop-list { overflow-x: hidden; }
.ed-bin .ed-clip-pop .ed-pop-list .ed-pop-item > span:first-child { flex: 1 1 auto; min-width: 0; }

/* ---------- history, layers, block editing, quick actions (AI editor v2) ---------- */
.ed-chat-h .ed-hist { margin-left: auto; display: inline-flex; gap: 4px; flex: none; }
.ed-chat-h .ed-hist .ed-mini, .ed-chat-h #edNew { margin-left: 0; }
.ed-ib-s { width: 28px; padding: 0; justify-content: center; }
.ed-ib-s svg { width: 15px; height: 15px; }
.ed-mini:disabled { opacity: .38; pointer-events: none; }
.ed-layers { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; max-width: 62%; }
.ed-layers::-webkit-scrollbar { display: none; }
.ed-layers[hidden] { display: none; }
.ed-lay-h { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; flex: none; margin-right: 2px; }
.ed-lay-h svg { width: 13px; height: 13px; }
.ed-lay { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px; border-radius: 99px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); font: 500 11.5px var(--font); cursor: pointer; flex: none; max-width: 220px; }
.ed-lay svg { width: 13px; height: 13px; flex: none; }
.ed-lay span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-lay.off { background: transparent; border-color: var(--line-2); color: var(--muted); text-decoration: line-through; }
.ed-lay:hover { filter: brightness(1.15); }
.ed-legend { margin-left: auto; }
.ed-layers ~ .ed-legend { margin-left: 8px; }
.ed-blk.editable::after { content: ""; position: absolute; right: 2px; top: 2px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .35; }
.ed-blkpop { position: absolute; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow-float); white-space: nowrap; }
.ed-blkpop[hidden] { display: none; }
.ed-blkpop button { height: 26px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 600 11.5px var(--font); cursor: pointer; }
.ed-blkpop button:hover { background: var(--hover); }
.ed-blkpop .bp-rm { color: var(--cut); }
.ed-blkpop .bp-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 2px; }
.m-undone { opacity: .5; }
.m-undone .m-me, .m-undone .m-body { text-decoration: none; }
.ed-quick { border-color: var(--accent-line); color: var(--text); }
.m-warn + .m-warn { margin-top: 6px; }
