/* The editor keeps its own look inside Ohdeo's shell: these are the colours it was drawn with. They are pinned on the
   editor's page and on everything it puts straight into <body> while it is open (menus, colour pickers, windows:
   class ve-skin, added by pages/video_editor.js), so the shell around it can change without the editor changing. */
.vedit-page, .ve-skin {
  --bg: #faf7f1; --panel: #ffffff; --side: #f1ece2; --ink: #1d2733; --muted: #66707c; --line: #e2dbcd;
  --brand: #173a5e; --brand-ink: #ffffff; --accent: #d9822b; --soft: #f4efe6; --danger: #b3382c; --ok: #2d7a4f;
  --shadow: 0 1px 2px rgba(23, 58, 94, .08), 0 4px 14px rgba(23, 58, 94, .06);
  color: var(--ink);
}
.vedit-page { background: var(--bg); }
@media (prefers-color-scheme: dark) {
  .vedit-page, .ve-skin { --bg: #12171d; --panel: #1a2129; --side: #161c23; --ink: #e8ecf1; --muted: #98a3b0; --line: #2a333e;
    --brand: #7fb2e5; --brand-ink: #0f1620; --accent: #f4a340; --soft: #202832; --danger: #ef7a6d; --ok: #6cc497;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); }
}
.page.vedit-page > .inner.wide { max-width: none; }
/* Ohdeo's shell has a top bar above the page (56 px) the editor's own height did not count */
@media (min-width: 1101px) { .vedit-page .ve { height: calc(100vh - 126px); } }
/* chips as the editor was drawn with them */
.vedit-page .chip, .ve-skin .chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; min-height: 36px; }
/* Video editor (#/video-editor/<id>): full-height editor, layers | preview | panel, timeline below. */
.vedit-page .ve-host { max-width: none; padding: 10px 14px; height: 100%; }
.vedit-page { height: 100%; }
.ve { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; height: calc(100vh - 70px); min-height: 640px; }
.ve-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ve-top h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.ve-spacer { flex: 1; }
.ve .btn.small { padding: 4px 9px; font-size: 13px; }
.ve .btn.on { background: var(--soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.ve-main { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); gap: 10px; min-height: 0; }
.ve-left, .ve-right { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; overflow: auto; min-height: 0; }
.ve-left h3, .ve-right h3 { font-size: 15px; margin: 2px 0 8px; }
.ve-center { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 6px; min-height: 0; min-width: 0; }
.ve-stagewrap { position: relative; display: grid; place-items: center; background: repeating-conic-gradient(#2a2f3a 0 25%, #232832 0 50%) 0 0 / 22px 22px; border-radius: 12px; overflow: auto; min-height: 260px; }
.ve-stage { position: relative; box-shadow: 0 4px 24px rgba(0, 0, 0, .45); }
.ve-player, .ve-overlay { position: absolute; inset: 0; }
.ve-overlay { z-index: 2; touch-action: none; user-select: none; }
.ve-sel { position: absolute; outline: 2px solid #38a3ff; outline-offset: 0; pointer-events: none; }
.ve-sel.est { outline-style: dashed; }
.ve-sel.locked { outline-color: #9aa3ad; }
.ve-hover { position: absolute; outline: 1px solid rgba(56, 163, 255, .75); pointer-events: none; }
.ve-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid #38a3ff; border-radius: 3px; pointer-events: auto; }
.ve-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; } .ve-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ve-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; } .ve-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ve-handle.n { left: calc(50% - 6px); top: -7px; cursor: ns-resize; } .ve-handle.s { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.ve-handle.e { right: -7px; top: calc(50% - 6px); cursor: ew-resize; } .ve-handle.w { left: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.ve-size { position: absolute; left: 0; top: 100%; margin-top: 6px; background: #38a3ff; color: #fff; font: 11px/1.4 system-ui, sans-serif; padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.ve-guide { position: absolute; pointer-events: none; background: #ff3d8b; }
.ve-guide.v { top: 0; bottom: 0; width: 1px; }
.ve-guide.h { left: 0; right: 0; height: 1px; }
.ve-guide.k-gap { background: #18c29c; }
.ve-guide.k-center { background: #38a3ff; }
.ve-guide.k-edge { background: #f5a623; }
.ve-guide.k-safe { background: #5fc66e; }
.ve-guidelabel { position: absolute; top: 3px; left: 5px; background: inherit; color: #fff; font: 11px/1.4 system-ui, sans-serif; padding: 0 5px; border-radius: 3px; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.ve-guide.v.late .ve-guidelabel { left: auto; right: 5px; }
.ve-guide.h .ve-guidelabel { top: 3px; }
.ve-guide.h.late .ve-guidelabel { top: auto; bottom: 3px; }
.ve .btn.ve-snapbtn { display: inline-flex; align-items: center; gap: 5px; }
.ve-snapbtn .ve-magnet { font-size: 15px; filter: grayscale(1); opacity: .55; }
.ve-snapbtn.on .ve-magnet { filter: none; opacity: 1; }
.ve-snapbtn .ve-snapstate { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 8px; background: var(--line); color: var(--muted, #666); }
.ve-snapbtn.on .ve-snapstate { background: var(--brand); color: var(--brand-ink, #fff); }
.ve-tlguide { position: absolute; top: 0; bottom: 0; width: 1px; background: #ff3d8b; pointer-events: none; z-index: 3; box-shadow: 0 0 0 1px rgba(255,61,139,.25); }
.ve-safe { position: absolute; border: 1px dashed rgba(95, 198, 110, .95); pointer-events: none; }
.ve-unsafe { position: absolute; background: rgba(255, 61, 139, .16); pointer-events: none; }
.ve-transport { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ve .btn.ve-soundbtn, .ve .btn.ve-togglebtn { display: inline-flex; align-items: center; gap: 5px; }
/* a narrow middle column (small laptop): buttons keep their sign and lose their words, so the row stays at two lines */
.ve.ve-narrow .ve-transport .ve-lbl { display: none; }
.ve.ve-narrow .ve-transport { gap: 4px; }
.ve-playbtn { min-width: 44px; font-weight: 700; }
.ve-time { font: 13px/1 ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.ve-check { display: inline-flex; align-items: center; gap: 6px; }
.ve-flash { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 50; max-width: min(720px, 90vw); padding: 8px 14px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; }
.ve-flash.bad { color: var(--danger); border-color: var(--danger); white-space: pre-wrap; }
.ve-flash.hide { display: none; }
.ve-rendered { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.ve-watch { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px; }
.ve-progress { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* layers */
.ve-addrow { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ve-layerlist { display: grid; gap: 2px; }
.ve-layer { display: grid; grid-template-columns: 22px minmax(0, 1fr) 24px 24px; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ve-layer:hover { background: var(--soft); }
.ve-layer.on { background: var(--brand); color: var(--brand-ink); }
.ve-layer.hidden .ve-lname { opacity: .5; text-decoration: line-through; }
.ve-lname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ve-ltype { font-weight: 700; text-align: center; opacity: .8; }
.ve-icon { border: 0; background: transparent; cursor: pointer; padding: 0; font-size: 13px; color: inherit; }
.ve-tools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; }

/* panel */
.ve-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -10px -10px 8px; padding: 6px 6px 0; position: sticky; top: -10px; z-index: 5; background: var(--panel); }
.ve-tab { border: 0; background: transparent; padding: 6px 9px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; color: var(--muted); }
.ve-tab.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.ve-panelbody { display: grid; gap: 8px; }
.ve-panelbody hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.ve-field { display: grid; gap: 3px; font-size: 13px; min-width: 0; }
.ve-flabel { color: var(--muted); font-size: 12px; }
.ve-field input[type=number], .ve-field input[type=text], .ve-field select, .ve-panelbody textarea, .ve-panelbody select { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 5px 7px; font: inherit; color: var(--ink); }
.ve-field input.bad { border-color: var(--danger); }
.ve-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.ve-sub { display: grid; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; }
.ve-swatches { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.ve-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.ve-sw.on { outline: 2px solid var(--brand); outline-offset: 2px; }
.ve-sw.none { background: var(--panel); font-size: 12px; line-height: 1; }
.ve-swatches input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.ve-src { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ve-src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ve-src audio { width: 100%; height: 30px; }
.ve-ailog { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.ve-aimsg { padding: 6px 9px; border-radius: 9px; font-size: 13px; background: var(--soft); }
.ve-aimsg.me { background: var(--brand); color: var(--brand-ink); justify-self: end; max-width: 90%; }
.ve-aimsg.err { color: var(--danger); }
.ve-aimsg.busy { font-style: italic; color: var(--muted); }
.ve-job { border-top: 1px solid var(--line); padding: 6px 0; font-size: 13px; display: grid; gap: 4px; }
.ve-job .chip.done { color: var(--ok); } .ve-job .chip.failed { color: var(--danger); }
.ve-jobres video { width: 100%; max-height: 180px; border-radius: 6px; }
.ve-jobres audio { width: 100%; height: 30px; }
.ve-keys { white-space: pre-wrap; font: 14px/1.6 system-ui, sans-serif; margin: 0; }

/* timeline */
.ve-timeline { user-select: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; display: grid; gap: 4px; max-height: 34vh; min-height: 120px; }
.ve-tlhead { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ve-tlscroll { overflow: auto; min-height: 0; }
.ve-tlbody { position: relative; width: max-content; min-width: 100%; }
.ve-tlrow { display: flex; align-items: center; min-height: 24px; }
.ve-tlname { position: sticky; left: 0; z-index: 3; flex: 0 0 150px; width: 150px; padding-right: 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel); color: var(--muted); }
.ve-tlname.on { color: var(--ink); font-weight: 600; }
.ve-lane { position: relative; height: 22px; border-bottom: 1px solid var(--line); }
.ve-ruler { height: 20px; cursor: pointer; border-bottom: 1px solid var(--muted); }
.ve-tick { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--line); font-size: 10px; padding-left: 2px; color: var(--muted); }
.ve-endmark { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); }
.ve-bar { position: absolute; top: 2px; height: 18px; border-radius: 5px; background: #6b8fb5; color: #fff; font-size: 11px; line-height: 18px; cursor: grab; overflow: hidden; box-sizing: border-box; touch-action: none; }
.ve-bar.text { background: #3f7fd0; } .ve-bar.image { background: #3c9a6c; } .ve-bar.shape { background: #d9822b; }
.ve-bar.clip { background: #6a5acd; } .ve-bar.clip.single { cursor: default; opacity: .8; } .ve-bar.track { background: #b0527a; }
.ve-bar.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #38a3ff; z-index: 2; }
.ve-bar.hidden { opacity: .45; }
.ve-barname { padding: 0 9px; white-space: nowrap; pointer-events: none; }
.ve-edge { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; background: rgba(255, 255, 255, .25); }
.ve-edge.l { left: 0; } .ve-edge.r { right: 0; }
.ve-anim { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, .22); pointer-events: none; }
.ve-anim.in { left: 0; } .ve-anim.out { right: 0; }
.ve-xfade { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .5), transparent); pointer-events: none; }
.ve-trbadge { position: absolute; left: 2px; top: 0; font-weight: 700; pointer-events: none; }
.ve-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #ff3d8b; pointer-events: none; z-index: 4; }

/* file picker */
dialog.ve-dialog { width: min(980px, 94vw); }
.ve-lib { display: grid; gap: 8px; }
.ve-lib-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ve-lib-top input[type=text] { width: 180px; }
.ve-lib-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ve-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: 60vh; overflow: auto; }
.ve-lib-item { display: grid; gap: 4px; border: 1px solid var(--line); background: var(--soft); border-radius: 9px; padding: 6px; cursor: pointer; text-align: left; color: var(--ink); }
.ve-lib-item:hover { border-color: var(--brand); }
.ve-lib-item img, .ve-lib-item video { width: 100%; height: 100px; object-fit: contain; background: #232832; border-radius: 6px; }
.ve-lib-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-lib-item audio { width: 100%; height: 28px; }
.ve-lib-audio { height: 60px; display: grid; place-items: center; font-size: 28px; }
.ve-start { max-width: 560px; display: grid; gap: 10px; }

@media (max-width: 1100px) {
  .ve { height: auto; }
  .ve-main { grid-template-columns: 1fr; }
  .ve-stagewrap { height: 60vh; }
}
