/* Montage editor (screens/montage.js), its timeline (ui/montage-timeline.js, .mtl on top of the Trim
   timeline's .tl) and the montage list on Your clips (ui/montage-shelf.js).
   The layout and the look are the Trim step's: a sidebar, the preview, a transport bar and the timeline.
   Pink is used only for the one primary button, the trim handles and the selected part's length pill. */

/* ---------- Layout ---------- */
.screen.screen-montage { height: calc(100vh - var(--header-h) - var(--status-bar-h, 0px)); height: calc(100dvh - var(--header-h) - var(--status-bar-h, 0px)); min-height: 600px; }
/* The sidebar is long: it scrolls inside the screen instead of making the screen (and the page) taller. */
.screen.screen-montage { max-height: max(600px, 100vh - var(--header-h) - var(--status-bar-h, 0px)); max-height: max(600px, 100dvh - var(--header-h) - var(--status-bar-h, 0px)); }
.screen-montage .mont-split { flex: 1; min-height: 0; }
.screen-montage .mont-side { padding: 16px 0 12px; gap: 18px; }
.screen-montage .mont-work { min-height: 0; }
.screen-montage .hint { margin: 0; }

/* ---------- Sidebar: name, numbers, notices ---------- */
.screen-montage .mont-head { gap: 8px; flex: none; }
.screen-montage .mont-name { height: 36px; padding: 0 8px; margin-left: -8px; width: calc(100% + 8px); background: transparent; box-shadow: none;
  font-family: var(--font-display); font-size: 24px; line-height: 30px; font-weight: 700; }
.screen-montage .mont-name:hover, .screen-montage .mont-name:focus { background: var(--c-field); box-shadow: var(--edge-field); }
/* The title with its pencil, as a clip has one. */
.screen-montage .mont-name-row { display: flex; align-items: center; gap: 4px; }
.screen-montage .mont-name-row .mont-name { flex: 1; min-width: 0; width: auto; }
.screen-montage .mont-name-edit { flex: none; color: var(--c-muted); }
.screen-montage .mont-name-edit:hover { color: var(--c-ink); }
.screen-montage .mont-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 0 2px; }
.screen-montage .mont-stat { display: flex; flex-direction: column; min-width: 0; }
.screen-montage .mont-stat-label { font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); }
.screen-montage .mont-notice { padding: 8px 10px; box-shadow: inset 2px 0 0 var(--c-ink); background: var(--c-field); font-size: var(--fs-m); line-height: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

/* ---------- Sidebar groups (rough cut, clips) ---------- */
.screen-montage .mont-group { display: flex; flex-direction: column; flex: none; }
.screen-montage .mont-group > .sec-label { padding: 0 16px 4px; }
.screen-montage .mont-group > .hint { padding: 4px 16px 0; }
.screen-montage .mont-cut { height: 30px; gap: 8px; }
.screen-montage .mont-cut-mark { width: 14px; flex: none; display: grid; place-items: center; }
.screen-montage .mont-cut-mark svg { visibility: hidden; }
.screen-montage .mont-cut[aria-checked="true"] .mont-cut-mark svg { visibility: visible; }
.screen-montage .mont-cut-title { flex: 1; min-width: 0; }
.screen-montage .mont-cut-desc { font-size: var(--fs-s); font-weight: 400; color: var(--c-muted); white-space: nowrap; }
.screen-montage .mont-cut:disabled .mont-cut-desc { color: var(--c-disabled); }
.screen-montage .mont-clip { min-height: 40px; gap: 10px; cursor: default; }
.screen-montage .mont-clip:hover { background: transparent; }
.screen-montage .mont-clip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 16px; }
.screen-montage .mont-clip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-montage .mont-clip-note { font-size: var(--fs-s); color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-montage .mont-more { align-self: flex-start; margin: 6px 16px 0; }

/* ---------- Music ---------- */
.screen-montage .mont-music { gap: 10px; flex: none; }
.screen-montage .mont-track { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.screen-montage .mont-track-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-montage .mont-slider { display: grid; grid-template-columns: 84px minmax(0, 1fr) 40px; align-items: center; column-gap: 8px; font-size: var(--fs-s); color: var(--c-muted); }
.screen-montage .mont-slider output { text-align: right; color: var(--c-ink); }
.screen-montage .mont-field { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; column-gap: 8px; height: 24px; font-size: var(--fs-s); color: var(--c-muted); }
.screen-montage .mont-field .field { font-size: var(--fs-m); }
.screen-montage .mont-field output { padding: 0 8px; text-align: right; color: var(--c-ink); font-family: var(--font-display); font-size: var(--fs-m); }
.screen-montage .mont-beats-fix { display: flex; flex-direction: column; gap: 8px; }
.screen-montage .mont-beats-fix > summary { cursor: pointer; font-size: var(--fs-s); color: var(--c-muted); }
.screen-montage .mont-beats-fix > summary:hover { color: var(--c-ink); }
.screen-montage .mont-beats-fix .mont-row { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 8px; }
.screen-montage .mont-upload { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Layout, gameplay effects, selected part ---------- */
.screen-montage .mont-layout { gap: 8px; flex: none; }
/* The effects are the Vertical step's controls (ui/finish-controls.js, placed by ui/montage-finish.js): three
   sections of this sidebar. Their wrappers add no box of their own. */
.screen-montage .mont-finish, .screen-montage .vertical-fx-moments { display: contents; }
.screen-montage .mont-finish[hidden], .screen-montage .vertical-fx-look[hidden], .screen-montage .vertical-fx-moments[hidden],
.screen-montage .vertical-look-intensity[hidden] { display: none; }
.screen-montage .vertical-fx-look, .screen-montage .vertical-fx-moments > .sec, .screen-montage .mont-fx-cuts { gap: 8px; flex: none; }
.screen-montage .vertical-looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.screen-montage .vertical-look { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 4px 4px 5px; text-align: center; }
.screen-montage .vertical-look-pic { position: relative; display: block; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-chip);
  background: var(--c-black) center / cover no-repeat; }
.screen-montage .vertical-look-pic.is-empty { background-image: linear-gradient(135deg, #2e5f9e 0%, #b8504a 52%, #e3bd62 100%); }
.screen-montage .vertical-look-wash { position: absolute; inset: 0; }
.screen-montage .vertical-look-name { font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-montage .vertical-look[aria-checked="true"] .vertical-look-name { color: var(--c-ink); font-weight: 600; }
.screen-montage .vertical-look-intensity { display: grid; grid-template-columns: 84px minmax(0, 1fr) 40px; align-items: center; column-gap: 8px; }
/* The montage's own kill zoom: the switch and its intensity, laid out like the look's. */
.screen-montage .mont-zoomfx, .screen-montage .mont-cardfx { gap: 8px; flex: none; }
/* The montage's fades: the music's rows sit inside the music section, which has its own padding. */
.screen-montage .mont-music .fade-music { padding: 0; }
.screen-montage .mont-zoom-intensity { display: grid; grid-template-columns: 84px minmax(0, 1fr) 40px; align-items: center; column-gap: 8px; }
.screen-montage .mont-zoom-intensity[hidden] { display: none; }
.screen-montage .mont-zoom-intensity .sec-label { font-size: var(--fs-s); color: var(--c-muted); }
.screen-montage .vertical-look-intensity .sec-label { font-size: var(--fs-s); color: var(--c-muted); }
.screen-montage .vertical-out { font-size: var(--fs-s); line-height: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.screen-montage .mont-sel { gap: 4px; flex: none; }
.screen-montage .mont-sel .hint { padding-bottom: 4px; }
.screen-montage .mont-sel-edit { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
.screen-montage .mont-saved { padding: 0 16px; }

/* ---------- Stage: the preview ---------- */
.screen-montage .mont-stage { padding: 12px; container-type: size; grid-template-rows: auto auto; align-content: center; row-gap: 8px; }
.screen-montage .mont-frame { position: relative; overflow: hidden; background: #000000; }
.screen-montage .mont-frame.is-vertical { height: min(100cqh - 44px, 604px); aspect-ratio: 9 / 16; border-radius: var(--r-phone); }
.screen-montage .mont-frame.is-wide { width: min(100%, 1024px, (100cqh - 44px) * 16 / 9); aspect-ratio: 16 / 9; }
.screen-montage .mont-screen { position: absolute; inset: 0; }
.screen-montage .mont-video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; background: #000000; visibility: hidden; }
.screen-montage .mont-video.is-on { visibility: visible; }
/* Gameplay effects over the preview (ui/montage-player.js): the look is a filter on the box that holds the
   videos, with a flat wash inside it; a kill effect or a transition is a flat layer or a blurred copy over it. */
.screen-montage .mont-grade { position: absolute; inset: 0; }
/* Only the gameplay (with its effects) zooms on a kill. Killcut's HUD and kill cards (ui/montage-hud.js) lie
   over it at export size, scaled to the frame: the layers of ui/clip-hud.js, as in the phone preview. */
.screen-montage .mont-zoom { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.screen-montage .mont-hud { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; transform-origin: 0 0; pointer-events: none; }
.screen-montage .mont-hud[hidden], .screen-montage .mont-hud-clip[hidden] { display: none; }
.screen-montage .mont-hud-clip { position: absolute; inset: 0; }
.screen-montage .mont-fx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
/* A clip's subtitles on the part in view (ui/caption-overlay.js): over the HUD and the cards, under the fades. */
.screen-montage .mont-captions { position: absolute; inset: 0; pointer-events: none; }
.screen-montage .mont-fx[hidden] { display: none; }
.screen-montage .mont-frame.is-dim .mont-screen { filter: brightness(0.4); }
.screen-montage .mont-frame-note { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 16px; color: var(--c-muted); font-size: var(--fs-m); text-align: center; background: #000000; }
.screen-montage .mont-preview-note { max-width: 520px; min-height: 16px; text-align: center; font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); }
.screen-montage .mont-result { position: absolute; inset: 0; width: 100%; height: 100%; background: #000000; }

/* ---------- Transport bar (as Trim's) ---------- */
.screen-montage .mont-bar { flex: none; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 12px; background: var(--c-panel); }
.screen-montage .mont-play { width: 36px; height: 36px; padding: 0; flex: none; }
.screen-montage .mont-play svg { width: 13px; height: 13px; }
.screen-montage .mont-tc { width: 8ch; flex: none; font-family: var(--font-display); font-size: 30px; line-height: 32px; font-weight: 700; }
.screen-montage .mont-length { font-size: var(--fs-s); color: var(--c-muted); white-space: nowrap; }
.screen-montage .mont-tools { margin-left: auto; display: flex; gap: 4px; }
.screen-montage .mont-bar > .tl-zoom { margin-left: auto; }
.screen-montage .mont-bar > .tl-zoom + .mont-tools { margin-left: 0; }
.screen-montage .mont-tool { height: 28px; padding: 0 8px; font-size: var(--fs-m); }
.screen-montage .mont-tool kbd { margin-left: 2px; }
.screen-montage .mont-tool.is-undo { margin-left: 8px; }

/* ---------- Timeline (.mtl: the montage's lanes on the Trim timeline's grid) ---------- */
.tl.mtl { --tl-rows: 24px 64px 44px 40px; }
.mtl .mtl-video { cursor: grab; }
.mtl.is-moving .mtl-video { cursor: grabbing; }
.mtl .mtl-part { overflow: hidden; background: var(--c-selected); cursor: inherit; }
.mtl .mtl-part::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.mtl .mtl-part.is-sel::after { box-shadow: inset 0 0 0 2px var(--c-ink); }
.mtl .mtl-part:not(.is-sel) .mtl-frames { opacity: 0.72; }
.mtl .mtl-part.is-lifted { z-index: 3; opacity: 0.9; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); }
.mtl .mtl-part.is-missing { background: repeating-linear-gradient(135deg, var(--c-field) 0 8px, var(--c-selected) 8px 16px); }
.mtl .mtl-frames { position: absolute; inset: 0; display: flex; pointer-events: none; }
.mtl .mtl-frames > * { flex: 1; min-width: 0; height: 64px; }
.mtl .mtl-frame > img { display: block; width: 100%; height: 64px; object-fit: cover; }
/* Zoomed in, a frame's stretch of a part is wider than the picture: the picture is repeated along it. */
.mtl.is-zoomed .mtl-frame { background-repeat: repeat-x; background-size: auto 100%; }
.mtl.is-zoomed .mtl-frame > img { visibility: hidden; }
.mtl .mtl-part-label { position: absolute; left: 6px; bottom: 4px; max-width: calc(100% - 12px); padding: 0 4px; border-radius: var(--r-chip);
  background: rgba(0, 0, 0, 0.72); color: #ffffff; font-size: var(--fs-xs); line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
/* A clip's footage outside the selected part: a slim band at the foot of the lane; on the side of an edge that
   is hovered, focused or dragged it fills the lane. Its own kills are the pink marks. */
.mtl .mtl-ghost { position: absolute; bottom: 0; height: 8px; z-index: 1; pointer-events: none; box-sizing: border-box;
  background: repeating-linear-gradient(135deg, rgba(255, 79, 203, 0.55) 0 4px, rgba(255, 79, 203, 0.2) 4px 8px); opacity: 0.75; }
.mtl.is-drag-in .mtl-ghost-before, .mtl:has(.tl-in:hover) .mtl-ghost-before, .mtl:has(.tl-in:focus-visible) .mtl-ghost-before,
.mtl.is-drag-out .mtl-ghost-after, .mtl:has(.tl-out:hover) .mtl-ghost-after, .mtl:has(.tl-out:focus-visible) .mtl-ghost-after { height: 100%; opacity: 0.38; outline: 1px dashed var(--c-pink); outline-offset: -1px; }
.mtl .mtl-ghost-kill { position: absolute; bottom: 0; width: 3px; height: 100%; margin-left: -1px; background: var(--c-white); box-shadow: 0 0 0 1px var(--c-black); }
/* Edge grips on a part the pointer is over: the pink trim handles before it is selected. */
.mtl .mtl-edge { position: absolute; top: 0; bottom: 0; width: 10px; z-index: 1; background: var(--c-pink); opacity: 0; cursor: ew-resize; touch-action: none; }
.mtl .mtl-edge-in { left: 0; }
.mtl .mtl-edge-out { right: 0; }
@media (hover: hover) { .mtl:not(.is-moving):not(.is-dragging) .mtl-part:not(.is-sel):not(.is-missing):hover .mtl-edge { opacity: 0.85; } }
.mtl .mtl-part.is-sel .mtl-edge, .mtl .mtl-part.is-missing .mtl-edge { display: none; }
.mtl .mtl-wave { right: auto; }
.mtl .mtl-drop { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; z-index: 4; border-radius: 2px; background: var(--c-white); box-shadow: var(--outline-marker); pointer-events: none; }
.mtl .mtl-scrub { cursor: ew-resize; touch-action: none; }
.mtl .mtl-music { height: 40px; background: var(--c-field); color: var(--c-ammo); touch-action: none; overflow: hidden; }
.mtl.has-music .mtl-music { cursor: grab; }
.mtl .mtl-music.is-slipping { cursor: grabbing; }
.mtl .mtl-wave { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.4; }
.mtl .mtl-beats { position: absolute; inset: 0; pointer-events: none; }
.mtl .mtl-beats > span { position: absolute; bottom: 0; width: 1px; height: 10px; background: var(--c-edge); }
.mtl .mtl-beats > span.strong { height: 18px; background: var(--c-ink); }
.mtl.has-music .tl-note { left: 6px; top: 4px; bottom: auto; padding: 0 4px; border-radius: var(--r-chip); background: rgba(0, 0, 0, 0.6); color: #ffffff; font-size: var(--fs-xs); line-height: 16px; }

/* ---------- Export view ---------- */
.screen-montage .mont-export-side { gap: 18px; }
.screen-montage .mont-panel { gap: 10px; }
.screen-montage .mont-panel .checklist { margin-top: 8px; }
.screen-montage .mont-panel .btn.block { margin-top: 4px; }
.screen-montage .mont-export-stage { padding: 16px; container-type: size; }
.screen-montage.is-export .mont-frame.is-vertical { height: min(100cqh, 604px); }
.screen-montage.is-export .mont-frame.is-wide { width: min(100%, 1024px, 100cqh * 16 / 9); }

/* ---------- Not in this browser ---------- */
.screen-montage .mont-gone { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 48px 32px; background: var(--c-panel); }

/* ---------- Phone width: the preview pinned on top, then transport, timeline and the sidebar ---------- */
@media (max-width: 899.98px) {
  .screen.screen-montage { height: auto; min-height: 0; max-height: none; }
  .screen-montage .mont-work { display: contents; }
  .screen-montage .mont-side { order: 1; overflow: visible; }
  .screen-montage .mont-stage { position: sticky; top: 0; z-index: 4; flex: none; container-type: normal; min-height: 0; box-shadow: 0 1px 0 var(--c-seam); }
  .screen-montage .mont-frame.is-vertical { height: 38vh; height: 38dvh; }
  .screen-montage .mont-frame.is-wide { width: min(100%, 38vh * 16 / 9); width: min(100%, 38dvh * 16 / 9); }
  .screen-montage.is-export .mont-frame.is-vertical { height: 56vh; height: 56dvh; }
  .screen-montage.is-export .mont-frame.is-wide { width: 100%; }
  .screen-montage .mont-export-stage { container-type: normal; flex: none; }
  .screen-montage .mont-bar { height: auto; min-height: 52px; flex-wrap: wrap; row-gap: 8px; padding: 8px 12px; }
  .screen-montage .mont-tc { font-size: 24px; line-height: 28px; }
  .screen-montage .mont-tools { flex-wrap: wrap; }
  .screen-montage .mont-gone { padding: 32px var(--gutter); }
}
@media (max-width: 899.98px) and (max-height: 519.98px) {
  .screen-montage .mont-stage { position: static; }
}
@media (max-width: 599.98px) {
  .screen-montage .mont-length { display: none; }
  .screen-montage .mont-tool kbd { display: none; }
}

/* ---------- Your clips: "Make a montage" and the montage list (ui/montage-shelf.js) ---------- */
.screen-clips .shelf { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 8px; border-top: 1px solid var(--c-field); }
.screen-clips .shelf[hidden] { display: none; }
.screen-clips .shelf-title { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; }
.screen-clips .shelf-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.screen-clips .shelf-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 10px 10px 14px; border-radius: var(--r-control); background: #171717; }
.screen-clips .shelf-item:hover { background: var(--c-field); }
.screen-clips .shelf-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.screen-clips .shelf-name { font-family: var(--font-display); font-size: 17px; line-height: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-clips .shelf-text:hover .shelf-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
/* What the montage holds and how its video is doing: all of it, on a second line when the card is narrow. */
.screen-clips .shelf-sub { font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); overflow-wrap: anywhere; }
.screen-clips .shelf-actions { display: flex; align-items: center; gap: 4px; }
.screen-clips .shelf-del, .screen-clips .shelf-ren { color: var(--c-muted); }
.screen-clips .shelf-ren:hover { color: var(--c-ink); }
.screen-clips .shelf-text.is-renaming { cursor: default; }
.screen-clips .shelf-name-input { height: 26px; margin: -2px 0 0 -8px; width: calc(100% + 8px); padding: 0 8px; background: var(--c-seam); font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.screen-clips .shelf-name-input:focus-visible { outline-offset: 0; }
.screen-clips .shelf-del:hover, .screen-clips .shelf-del[aria-expanded="true"] { color: var(--c-ink); background: var(--c-field); }
.screen-clips .shelf-confirm { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 12px; border-radius: var(--r-control); background: var(--c-field); font-size: var(--fs-m); line-height: 18px; }
.screen-clips .shelf-confirm-actions { flex: none; display: flex; gap: 4px; }
.screen-clips .shelf-note { font-size: var(--fs-s); line-height: 16px; color: var(--c-muted); }
.screen-clips .clips-bar-hint { font-size: var(--fs-s); color: var(--c-muted); }
@media (max-width: 899.98px) {
  .screen-clips .shelf-list { grid-template-columns: 1fr; }
  .screen-clips .shelf-confirm { flex-direction: column; align-items: stretch; }
  .screen-clips .shelf-confirm-actions { justify-content: flex-end; }
}
