/* ScenePilot editor (inside the studio, #edit-<film>). Same tokens as studio.css.
   Layout from VEED's editor on Mobbin: tool rail, one side panel, the player, lanes underneath.
   Features kept from the desktop editor: six lanes, swap shots, move sounds and graphics, camera moves,
   graphic template/text/timing, caption edits, sound effects at the playhead, music, render settings,
   undo, render changes, download. */

body.editing { overflow: hidden; }
body.editing .top, body.editing .island { display: none !important; }
#view-edit.on { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--paper); animation: none; padding-top: env(safe-area-inset-top, 0px); }

/* top bar */
.ebar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.e-title { display: grid; min-width: 0; flex: 1; }
.e-title input { border: 0; outline: 0; background: none; font: 650 16px var(--font); letter-spacing: -.02em; color: var(--ink); padding: 2px 4px; margin-left: -4px; border-radius: 6px; min-width: 0; text-overflow: ellipsis; }
.e-title input:hover, .e-title input:focus { background: var(--sunk); }
.e-title small { font-size: 12px; color: var(--ink-3); padding-left: 1px; }
.e-hist { display: flex; gap: 6px; }
.e-hist .round:disabled { opacity: .4; cursor: default; }
.e-actions { display: flex; gap: 8px; align-items: center; }
#e-render .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ember); color: #fff; font-size: 11.5px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
#e-render:disabled .n { display: none; }

/* work area */
.ework { display: grid; grid-template-columns: 76px 340px minmax(0, 1fr); min-height: 0; }
.erail { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; background: var(--panel); border-right: 1px solid var(--line); }
.erail button { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border: 0; border-radius: 12px; background: none; color: var(--ink-3); font: 550 11.5px var(--font); cursor: pointer; transition: background .2s, color .2s; }
.erail button:hover { color: var(--ink); background: var(--sunk); }
.erail button.on { color: var(--ink); background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-2); }
.erail button.on .ic { color: var(--ec, var(--violet)); }
.erail [data-etool="shot"] { --ec: var(--blue); } .erail [data-etool="graphics"] { --ec: var(--violet); } .erail [data-etool="captions"] { --ec: var(--amber); } .erail [data-etool="sound"] { --ec: var(--green); } .erail [data-etool="film"] { --ec: var(--ember); }
.erail .ic { width: 20px; height: 20px; }
.epanel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 18px; display: grid; grid-auto-rows: max-content; gap: 16px; align-content: start; overscroll-behavior: contain; }
.ep-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ep-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.ep-head small { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ep-close { display: none; }
.ep-sec { display: grid; gap: 10px; }
.ep-sec > b { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ep-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--sunk) center / cover; border: 1px solid var(--line); }
.ep-thumb span { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ep-quote { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--sunk); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.ep-quote::before { content: "“"; } .ep-quote::after { content: "”"; }
.ep-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ep-facts div { background: var(--panel); padding: 8px 10px; min-width: 0; }
.ep-facts span { display: block; font-size: 11.5px; color: var(--ink-3); }
.ep-facts b { font-size: 13px; font-weight: 600; }
.alts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.alt { aspect-ratio: 16 / 9; border-radius: 9px; border: 2px solid transparent; background: var(--sunk) center / cover; cursor: pointer; padding: 0; transition: border-color .2s, transform .2s; }
.alt:hover { border-color: var(--violet); transform: translateY(-1px); }
.upl { display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 9px; border-radius: 12px; border: 1px solid var(--line); background: var(--sunk); font-size: 13px; color: var(--ink-2); cursor: pointer; }
.upl .ic { width: 26px; height: 26px; padding: 6px; border-radius: 50%; background: var(--blue); color: var(--paper); }
.upl input { display: none; }
.glist, .clist, .slist { display: grid; gap: 4px; }
.gitem, .sitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; background: none; text-align: left; color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; width: 100%; }
.gitem:hover, .sitem:hover { background: var(--sunk); }
.gitem.on, .sitem.on { border-color: var(--violet); background: var(--lilac); }
.gitem i, .sitem i { width: 10px; height: 10px; border-radius: 3px; background: var(--p-bd); flex: none; }
.gitem span, .sitem span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gitem small, .sitem small { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.tpls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl { display: grid; gap: 4px; padding: 0; border: 0; background: none; color: var(--ink-2); font: 550 11.5px var(--font); cursor: pointer; text-align: left; }
.tpl img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; border: 2px solid transparent; transition: border-color .2s; }
.tpl.on img { border-color: var(--ink); }
.tpl.on { color: var(--ink); }
.gprev { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: #000; object-fit: cover; }
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.citem { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; padding: 4px; border-radius: 10px; }
.citem.on { background: var(--lilac); }
.citem button { border: 0; background: none; color: var(--ink-3); font: 500 12px var(--font); font-variant-numeric: tabular-nums; cursor: pointer; text-align: left; padding: 6px 4px; }
.citem input { height: 34px; font-size: 13.5px; }
.mute-note { font-size: 12.5px; color: var(--ink-3); margin: 0; }
.range-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.range-row input { flex: 1; accent-color: var(--violet); }
.range-row output { font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.e-empty { display: grid; gap: 10px; justify-items: start; padding: 4px 0; }

/* player */
.stagebox { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; padding: 18px 22px 12px; min-width: 0; min-height: 0; }
.monitor { position: relative; justify-self: center; align-self: center; height: 100%; max-height: 100%; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 16px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.monitor video, .monitor .over { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.monitor .over { object-fit: cover; }
.e-cap { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); max-width: 80%; padding: 5px 12px; border-radius: 8px; background: rgba(0, 0, 0, .7); color: #fff; font-size: clamp(12px, 1.7vw, 19px); font-weight: 600; text-align: center; line-height: 1.3; }
.e-cap:empty { display: none; }
.e-tag { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.e-tag span { padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11.5px; font-weight: 600; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.e-tag .chg { background: var(--ember); }
.bigplay { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #121114; display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .2s, opacity .2s; }
.bigplay .ic { width: 24px; height: 24px; fill: currentColor; stroke: none; margin-left: 3px; }
.bigplay:hover { transform: scale(1.06); }
.monitor.playing .bigplay { opacity: 0; pointer-events: none; }
.transport { display: flex; align-items: center; gap: 12px; justify-self: center; width: min(100%, 820px); }
.transport .play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.transport .play .ic { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.tc { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tc b { color: var(--ink); font-weight: 600; }
.shotno { font-size: 13px; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; background: var(--sunk); }
.transport .sp { flex: 1; }

/* timeline */
.tl { border-top: 1px solid var(--line); background: var(--panel); display: grid; grid-template-rows: auto auto; min-width: 0; }
.tl-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.tl-hint { font-size: 12px; color: var(--ink-3); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom input { width: 110px; accent-color: var(--violet); }
.tl-body { display: grid; grid-template-columns: 92px minmax(0, 1fr); }
.tl-heads { display: grid; grid-template-rows: 26px 26px 56px 34px 42px 28px 26px; border-right: 1px solid var(--line); background: var(--panel); }
.tl-heads span { display: flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.tl-heads span:last-child { border-bottom: 0; }
.tl-heads i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; scrollbar-width: thin; cursor: text; }
.tl-inner { position: relative; display: grid; grid-template-rows: 26px 26px 56px 34px 42px 28px 26px; min-width: 100%; }
.lane { position: relative; border-bottom: 1px solid var(--line); }
.lane:last-child { border-bottom: 0; }
.ruler { position: relative; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sunk) 50%, var(--panel)); cursor: ew-resize; }
.ruler i { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--line-2); }
.ruler i.big { height: 9px; background: var(--ink-3); }
.ruler b { position: absolute; top: 3px; transform: translateX(-50%); font-size: 10.5px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.it { position: absolute; top: 3px; bottom: 3px; border-radius: 7px; overflow: hidden; display: flex; align-items: center; padding: 0 7px; font-size: 11px; font-weight: 600; white-space: nowrap; cursor: pointer; border: 1.5px solid transparent; transition: box-shadow .15s; }
.it.on { box-shadow: 0 0 0 2px var(--ink); z-index: 2; }
.it span { overflow: hidden; text-overflow: ellipsis; }
.ecap { background: var(--glass); border-color: var(--line-2); color: var(--ink-2); font-weight: 500; }
.eshot { top: 4px; bottom: 4px; padding: 0; background: var(--sunk) left center / auto 100% repeat-x; border-color: var(--line); cursor: grab; }
.eshot b { position: absolute; left: 4px; top: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 10.5px; display: grid; place-items: center; }
.eshot.chg { border-color: var(--ember); }
.eshot.chg::after { content: ""; position: absolute; right: 4px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 0 2px #fff; }
.eshot.drop { box-shadow: 0 0 0 2px var(--violet); }
.eshot.ghost { opacity: .35; }
.egfx { background: var(--p-bg); border-color: var(--p-bd); color: var(--ink); cursor: grab; gap: 5px; }
.egfx small { font-weight: 500; color: var(--ink-2); }
.esfx { background: var(--p4-bg); border-color: var(--p4-bd); color: var(--ink); top: 4px; bottom: 4px; cursor: grab; min-width: 18px; padding: 0 5px; }
.emusic { background: var(--p2-bg); border-color: var(--p2-bd); color: var(--ink); }
.emusic.off { opacity: .35; }
.wave { position: absolute; inset: 4px 0; width: 100%; height: calc(100% - 8px); }
.dragging, .dragging * { cursor: grabbing !important; user-select: none; }
.phead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ember); z-index: 5; pointer-events: none; }
.phead::before { content: ""; position: absolute; top: 0; left: -6px; width: 14px; height: 14px; border-radius: 4px 4px 7px 7px; background: var(--ember); }

/* loading and not-ready */
.e-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; background: radial-gradient(60% 80% at 50% 50%, #2a1f4a, #0b0a12); text-align: center; padding: 20px; }

@media (max-width: 900px) {
  #view-edit.on { grid-template-rows: auto auto minmax(0, 1fr); }
  .ebar { padding: 8px 10px; gap: 8px; }
  .e-hist .round { width: 34px; height: 34px; }
  #e-download { display: none; }
  #e-render { padding: 0 12px; }
  .ework { display: block; }
  .stagebox { padding: 10px 10px 6px; gap: 8px; }
  .monitor { height: auto; width: 100%; border-radius: 12px; }
  .transport { gap: 8px; }
  .shotno { display: none; }
  .tl { border-top: 1px solid var(--line); padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); overflow: hidden; align-content: start; }
  .tl-hint { display: none; }
  .tl-bar { justify-content: space-between; }
  .zoom input { width: 80px; }
  .tl-body { grid-template-columns: 30px minmax(0, 1fr); }
  .tl-heads span { padding: 0; justify-content: center; font-size: 0; }
  .tl-heads i { width: 9px; height: 9px; }
  .erail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 36; flex-direction: row; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line); }
  .erail button { flex: 1; padding: 6px 2px; }
  .epanel { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); z-index: 35; max-height: 58dvh; border-radius: 20px 20px 0 0; border: 1px solid var(--line); box-shadow: 0 -20px 50px -20px rgba(20, 10, 40, .35); transform: translateY(110%); visibility: hidden; transition: transform .35s cubic-bezier(.2, .8, .2, 1), visibility 0s .35s; }
  .epanel.open { transform: none; visibility: visible; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
  .ep-close { display: grid; }
}

/* the film's thumbnail, at the end of the Film panel */
.ep-cover .ethumb { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; }
.ep-cover .ethumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-cover .ethumb span { padding: 0 18px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
.ep-cover .row { display: flex; flex-wrap: wrap; gap: 8px; }
.ep-cover .btn .ic { width: 15px; height: 15px; margin-right: 6px; }
