/* dive-in.html — the dive-in editor test page (MCB-STUDIO-TRYIT-DIVE-IN-1004, throwaway proof; mcbopus).
   The picture is the largest thing. ONE strip under it (frames · words · sound). Every control is in the right panel,
   which opens and closes on a click; anything with more than one field pops out OVER the picture and never resizes it.
   Tokens from theme.css only. */
html, body { width: 100%; height: 100%; overflow: hidden; }
[hidden] { display: none !important; }
.dv { --side-w: 328px; --strip-h: 150px; --bar-h: 44px; display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); grid-template-rows: var(--sf-top-h, 52px) minmax(0, 1fr); height: 100vh; transition: grid-template-columns .18s ease; }
.dv[data-panel="shut"] { --side-w: 34px; }
.dv .sf-top { grid-column: 1 / -1; }
.btn, .dv-chip, .dv-note, .dv-join, .dv-flag { cursor: pointer; user-select: none; }
.btn[aria-disabled="true"], .dv-chip[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
button.btn, button.dv-chip, button.dv-note { font-family: var(--ui); }

/* ---- the work: picture, transport, strip ---- */
.dv-stage { display: flex; flex-direction: column; gap: 8px; padding: 12px 10px 10px 16px; min-width: 0; min-height: 0; position: relative; }
.dv-picwrap { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; position: relative; container-type: size; }
.dv-pic { position: relative; width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9; border-radius: var(--r-screen); overflow: hidden; background: var(--well); }
.dv-pic video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--well); opacity: 0; pointer-events: none; }
.dv-pic video.on { opacity: 1; }
/* paused: each clip's frame is on its own canvas (what was decoded is what is shown); the videos are on screen only while playing */
.dv-pic canvas.dv-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--well); opacity: 0; pointer-events: none; }
.dv-pic[data-still="true"] video.on { opacity: 0 !important; }
.dv-pic[data-still="true"] canvas.dv-still.on { opacity: 1; z-index: 1; }
.dv-pic[data-still="true"] canvas.dv-still.on.b { z-index: 2; }   /* Overlay: the clip after lies OVER the clip before, so the mix slider shows through it (the clips sit in the page last-first) */
.dv-pic.sbs canvas.dv-still.on { width: 50%; } .dv-pic.sbs canvas.dv-still.on.b { left: 50%; }
.dv-pic { background-repeat: no-repeat; } .dv-pic[data-wait="true"] video.on, .dv-pic[data-wait="true"] canvas.dv-still.on { opacity: 0 !important; }
.dv-pic.sbs video.on { width: 50%; } .dv-pic.sbs video.on.b { left: 50%; }
.dv-pic.sbs::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
.dv-tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 3; pointer-events: none; max-width: calc(100% - 20px); }
.dv-tag { height: 28px; padding: 0 10px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .58); color: #ecebe7; backdrop-filter: blur(6px); white-space: nowrap; }
.dv-tag.hot { background: var(--accent); color: var(--on-accent); }
.dv-pic.sbs .dv-tags { right: 10px; max-width: none; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; justify-items: start; }
.dv-ov { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, .58); color: #ecebe7; font-size: 12.5px; }
.dv-ov input { width: 180px; accent-color: var(--accent); }

.dv-bar { flex: none; height: var(--bar-h); display: flex; align-items: center; gap: 8px; min-width: 0; }
.dv-bar .btn { height: 34px; }
.dv-bar .ico { width: 34px; padding: 0; font-size: 16px; }
.dv-time { font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.dv-time small { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.dv-crumb { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.dv-crumb b { color: var(--text); font-weight: 600; }
.dv-fps { font-size: 12.5px; color: var(--accent-ink); font-variant-numeric: tabular-nums; }

.dv-strip { flex: none; height: var(--strip-h); position: relative; border-radius: 8px; background: var(--panel); border: 1px solid var(--line-soft); overflow: hidden; user-select: none; touch-action: pan-x; }
.dv-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.dv-lane { position: relative; height: 100%; min-width: 100%; }
.dv-flags { position: absolute; left: 0; right: 0; top: 0; height: 20px; }
.dv-flag { position: absolute; top: 2px; height: 17px; min-width: 22px; padding: 0 5px; border: 0; border-radius: 4px 4px 4px 0; background: var(--accent); color: var(--on-accent); font: 700 10.5px/17px var(--ui); transform: translateX(-1px); z-index: 6; }
.dv-flag::after { content: ""; position: absolute; left: 0; top: 17px; width: 2px; height: 56px; background: var(--accent); opacity: .8; pointer-events: none; }
.dv-flag[aria-pressed="true"] { outline: 2px solid var(--text); }
.dv-frames { position: absolute; left: 0; right: 0; top: 20px; height: 56px; }
.dv-block { position: absolute; top: 0; height: 54px; border-radius: 5px; overflow: hidden; background: var(--well); border: 1px solid var(--line); padding: 0; display: block; }
button.dv-block { cursor: pointer; }
button.dv-block:hover, button.dv-block:focus-visible { border-color: var(--accent-line); }
.dv-block[data-open="true"] { border-color: var(--accent); }
.dv-tile { position: absolute; top: 0; background-repeat: no-repeat; }
.dv-tile span { position: absolute; left: 3px; bottom: 2px; font: 600 9.5px var(--ui); color: #ecebe7; text-shadow: 0 0 3px #000, 0 0 3px #000; font-variant-numeric: tabular-nums; }
.dv-tile.cut { opacity: .28; }
.dv-tile.rt { box-shadow: inset 0 -3px 0 var(--run); }
.dv-bname { position: absolute; left: 5px; top: 4px; z-index: 2; display: flex; gap: 4px; flex-wrap: nowrap; max-width: calc(100% - 10px); overflow: hidden; }
.dv-bname i { font: 600 11px/18px var(--ui); font-style: normal; height: 18px; padding: 0 6px; border-radius: 4px; background: rgba(0, 0, 0, .62); color: #ecebe7; white-space: nowrap; }
.dv-bname i.m-edit { background: var(--accent); color: var(--on-accent); }
.dv-bname i.m-shift { background: var(--run); color: #0c1220; }
.dv-bname i.m-shoot { background: var(--need); color: #1d0703; }
.dv-bname i.m-same { color: #b9bbc1; }
.dv-join { position: absolute; top: 0; width: 16px; height: 54px; border: 0; background: transparent; padding: 0; z-index: 5; }
.dv-join::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--text-2); }
.dv-join::after { content: ""; position: absolute; left: 2px; top: 21px; width: 12px; height: 12px; transform: rotate(45deg); background: var(--panel); border: 2px solid var(--text-2); border-radius: 2px; }
.dv-join:hover::after, .dv-join:focus-visible::after, .dv-join[data-open="true"]::after { border-color: var(--accent); background: var(--accent); }
.dv-join[data-edited="true"]::after { border-color: var(--accent); }
.dv-jword { position: absolute; z-index: 6; height: 18px; padding: 0 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text-2); font: 600 10.5px/16px var(--ui); cursor: pointer; white-space: nowrap; }
.dv-jword:hover, .dv-jword:focus-visible { border-color: var(--accent); color: var(--accent-ink); }
.dv-jword.mid { top: 2px; transform: translateX(-50%); } .dv-jword.left { bottom: 2px; } .dv-jword.right { bottom: 2px; transform: translateX(-100%); }
.dv-handle { position: absolute; top: -2px; width: 12px; height: 58px; margin-left: -6px; border: 0; padding: 0; background: transparent; cursor: ew-resize; z-index: 7; touch-action: none; }
.dv-handle::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--accent); }
.dv-words { position: absolute; left: 0; right: 0; top: 78px; height: 22px; }
.dv-word { position: absolute; top: 2px; height: 18px; padding: 0 3px; font: 13px/18px var(--read); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 1px solid var(--line); }
.dv-word.in { color: var(--text); background: var(--accent-soft); }
.dv-wave { position: absolute; left: 0; right: 0; top: 100px; bottom: 0; }
.dv-wave canvas { position: absolute; left: 0; top: 0; height: 100%; }
.dv-sel { position: absolute; top: 20px; height: 56px; background: var(--accent-soft); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); pointer-events: none; z-index: 4; }
.dv-sel.voice { top: 78px; height: auto; bottom: 0; }
/* fewer frames a second shown: the frames row scrolls, the words and the sound stay put with their own playhead and a box for the stretch on show */
.dv-lane[data-fit="true"] .dv-head { bottom: auto; height: 78px; }
.dv-head2 { position: absolute; top: -24px; height: 74px; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; z-index: 3; }
.dv-win { position: absolute; top: -22px; height: 72px; border: 1px solid var(--accent-line); border-radius: 4px; background: var(--accent-soft); pointer-events: none; }
.dv-said { font: 600 12.5px/1.35 var(--ui); color: var(--text); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 8px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.dv-edh { padding-top: 4px; font-weight: 600; }
.dv-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); z-index: 8; pointer-events: none; }
.dv-head::before { content: ""; position: absolute; left: -4px; top: 0; border: 5px solid transparent; border-top-color: var(--text); }
.dv-cutline { position: absolute; top: 20px; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 5; pointer-events: none; }
.dv-tick { position: absolute; bottom: 0; font: 10.5px var(--ui); color: var(--muted); transform: translateX(-50%); pointer-events: none; font-variant-numeric: tabular-nums; }

/* ---- the right panel: opens and closes on a click ---- */
.dv-side { position: relative; min-width: 0; min-height: 0; background: var(--bg-2); border-left: 1px solid var(--line-soft); display: flex; }
.dv-tab { flex: none; width: 34px; border: 0; background: transparent; color: var(--text-2); font-size: 16px; cursor: pointer; display: grid; place-items: start center; padding-top: 14px; }
.dv-tab:hover { color: var(--text); background: var(--hover); }
.dv-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 14px 0; overflow: hidden; }
.dv-panel > * { flex: none; }
.dv[data-panel="shut"] .dv-panel { display: none; }
.dv-ph { display: grid; gap: 2px; }
.dv-ph .eb { font: 600 11.5px var(--ui); color: var(--accent-ink); letter-spacing: .02em; }
.dv-ph h1 { font: 600 19px/1.2 var(--cond); color: var(--text); margin: 0; }
.dv-ph .sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-panel .btn.wide { width: 100%; }
.dv-panel .btn.primary { height: 46px; font-size: 15px; }
.dv-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dv-chips.one { grid-template-columns: 1fr; }
.dv-chip { display: grid; gap: 1px; text-align: left; padding: 8px 11px; min-height: 50px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.dv-chip:hover, .dv-chip[aria-expanded="true"] { border-color: var(--accent-line); }
.dv-chip .l { font-size: 11.5px; color: var(--muted); }
.dv-chip .v { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-chip.paid .v { color: var(--accent-ink); }
.dv-prompt { text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font: 13.5px/1.45 var(--ui); display: grid; gap: 4px; cursor: pointer; }
.dv-prompt:hover { border-color: var(--accent-line); }
.dv-prompt .l { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dv-prompt .go { flex: none; padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); font-size: 12px; line-height: 1.3; }
.dv-prompt:hover .go, .dv-prompt:focus-visible .go { border-color: var(--accent-line); color: var(--accent); }
.dv-prompt .t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.dv-notes { display: grid; gap: 6px; }
.dv-note { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: baseline; text-align: left; padding: 7px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.dv-note:hover { border-color: var(--accent-line); }
.dv-note .n { font: 700 11px var(--ui); background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 1px 5px; }
.dv-note .w { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-note .t { grid-column: 1 / -1; font: 13px/1.35 var(--read); color: var(--text-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.dv-panel > .dv-grow { flex: 1; min-height: 0; }
.dv-seg { display: flex; padding: 3px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); gap: 2px; }
.dv-seg button { flex: 1; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font: 500 13px var(--ui); cursor: pointer; }
.dv-seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }

/* ---- pop-outs: over the picture, beside the panel ---- */
.dv-pop { position: absolute; right: 12px; z-index: 40; width: 320px; max-width: calc(100% - 28px); display: grid; gap: 10px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
.dv-pop h2 { font: 600 14px var(--ui); margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dv-pop .x { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
.dv-pop .x:hover { background: var(--hover); color: var(--text); }
.dv-pop .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dv-pop .kv b { color: var(--text); font-weight: 600; text-align: right; }
.dv-pop .fld { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.dv-pop .fld input { width: 84px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 600 14px var(--ui); font-variant-numeric: tabular-nums; }
.dv-pop .fld .grow { flex: 1; }
.dv-pop .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.dv-pop .acts .btn { flex: 1; }
.dv-pop .quote { font: 14.5px/1.5 var(--read); color: var(--text); max-height: 240px; overflow: auto; }
.dv-pop .who { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-nudge { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dv-grab { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--well) center / contain no-repeat; border: 1px solid var(--line); }
.dv-tray { display: flex; gap: 6px; overflow-x: auto; }
.dv-tray button { flex: none; width: 64px; height: 36px; border-radius: 5px; border: 1px solid var(--line); background: var(--well) center / cover no-repeat; cursor: pointer; padding: 0; }
.dv-tray button[aria-pressed="true"] { border-color: var(--accent); }
.dv-edits { display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.dv-edit { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.dv-edit b { color: var(--text); font-weight: 600; }
.dv-edit .was { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- the prompt, large over the picture: the card's lines beside the same words in the big prompt ---- */
.dv-big { position: absolute; inset: 0; z-index: 30; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px 14px; padding: 14px; background: var(--panel); border: 1px solid var(--accent-line); border-radius: var(--r-panel); box-shadow: var(--shadow-pop); }
.dv-big header { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.dv-big header h2 { font: 600 15px var(--ui); margin: 0; flex: 1; }
.dv-big .col { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 6px; }
.dv-big .col > .l { font-size: 11.5px; color: var(--muted); }
.dv-card { overflow: auto; display: grid; gap: 8px; align-content: start; padding-right: 4px; }
.dv-line { display: grid; gap: 3px; }
.dv-line label { font: 600 11.5px var(--ui); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.dv-line textarea, .dv-full { width: 100%; resize: none; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 14px/1.5 var(--ui); padding: 9px 11px; }
.dv-line textarea { min-height: 92px; }
.dv-line textarea:focus, .dv-full:focus { outline: none; border-color: var(--accent); }
.dv-line[data-changed="true"] textarea { border-color: var(--accent-line); background: var(--accent-soft); }
.dv-full { height: 100%; font-size: 13.5px; }

/* ---- the phone: picture, strip, then the panel; pop-outs come up from the bottom over the panel ---- */
@media (max-width: 760px) {
  .dv { display: flex; flex-direction: column; height: 100dvh; --strip-h: 138px; }
  .dv-stage { flex: none; padding: 8px 8px 6px; gap: 6px; }
  .dv-picwrap { flex: none; container-type: normal; display: block; }
  .dv-pic { width: 100%; }
  .dv-crumb { display: none; }
  .dv-side { flex: 1; border-left: 0; border-top: 1px solid var(--line-soft); }
  .dv-tab { display: none; }
  .dv-panel { padding: 10px; overflow: auto; }
  .dv[data-panel="shut"] .dv-panel { display: flex; }
  .dv-panel .btn.primary { height: 42px; }
  .dv-chip { min-height: 44px; padding: 6px 10px; }
  .dv-pop { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto !important; width: auto; max-width: none; max-height: 46dvh; overflow: auto; }
  .dv-big { position: fixed; inset: calc(var(--sf-top-h, 70px) + 4px) 6px 6px 6px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .dv { transition: none; } }
