/* Video Lab: страницы в общем стиле пула; редактор — тёмный, как монтажные программы */
:root {
  --bg: #f6f6f4; --panel: #fff; --text: #1d1d1f; --muted: #6e6e73; --line: #e3e3e0;
  --accent: #2f6fde; --err: #c62828; --ok: #2e7d32; --chip: #ececea; color-scheme: light;
  --ed-bg: #141416; --ed-panel: #1d1d21; --ed-line: #2e2e34; --ed-text: #e8e8ea; --ed-muted: #8d8d95;
  --clip: #3b5f9e; --clip-sel: #e0a63a; --head: #ff4d4d;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151517; --panel: #1f1f22; --text: #ececec; --muted: #9a9aa0; --line: #313136;
          --accent: #5b8ff0; --chip: #2a2a2f; --err: #ef6c6c; --ok: #66bb6a; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
input, button, select { font: inherit; color: inherit; }
input:not([type=checkbox]) { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 0; }
button, .btn { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; }
button.small, .btn.small { padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .45; cursor: default; }
.muted { color: var(--muted); } .small { font-size: 13px; } .grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 16px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.page { max-width: 1100px; margin: 0 auto; padding: 16px; }
.top { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; color: var(--text); white-space: nowrap; }
.top .out { margin-left: auto; color: var(--muted); }
.top .title { flex: 1; max-width: 420px; background: transparent; border-color: transparent; font-weight: 600; }
.top .title:hover, .top .title:focus { border-color: var(--line); }
.flash { margin: 10px 16px; padding: 8px 12px; border-radius: 8px; background: #2e7d3222; }
.flash.error { background: #c6282822; color: var(--err); }
.login { max-width: 340px; margin: 12vh auto; display: grid; gap: 10px; }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.plist { display: grid; gap: 6px; }
.pitem { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--chip); color: var(--text); }
.bin { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.mitem { position: relative; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.mitem img, .mitem .noimg { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #0003; display: grid; place-items: center; color: var(--muted); }
.mitem .acts { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.mitem .acts button { padding: 0 7px; line-height: 22px; border: 0; background: #000b; border-radius: 11px; }

/* --- редактор --- */
body.editor-page { background: var(--ed-bg); color: var(--ed-text); }
body.editor-page .top { background: var(--ed-panel); border-color: var(--ed-line); }
body.editor-page .brand, body.editor-page .top .title { color: var(--ed-text); }
body.editor-page input:not([type=checkbox]) { background: #0006; border-color: var(--ed-line); }
.editor { display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 210px;
          height: calc(100vh - 49px); gap: 1px; background: var(--ed-line); }
.pane { background: var(--ed-panel); min-height: 0; overflow: auto; padding: 8px; }
.pane-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bin-pane { grid-row: 1; }
.bin-pane .bin { grid-template-columns: 1fr 1fr; }
.viewer { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.viewer video { flex: 1; min-height: 0; width: 100%; background: #000; border-radius: 6px; }
.transport { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.transport button { background: #ffffff12; border-color: #ffffff1f; color: var(--ed-text); padding: 5px 10px; }
.transport button.accent { background: var(--accent); border-color: var(--accent); }
.transport .sep { width: 10px; }
.tc { font: 600 14px ui-monospace, Menlo, monospace; min-width: 150px; }
.renders a { color: #9fc0ff; }
.timeline-pane { grid-column: 1 / -1; }
.timeline { position: relative; overflow-x: auto; overflow-y: hidden; height: 150px; background: #0005; border-radius: 6px; cursor: text; }
.ruler { position: relative; height: 22px; border-bottom: 1px solid var(--ed-line); font: 11px ui-monospace, Menlo, monospace; color: var(--ed-muted); }
.ruler span { position: absolute; top: 4px; padding-left: 3px; border-left: 1px solid var(--ed-line); height: 18px; }
.track { position: relative; height: 96px; margin-top: 10px; }
.clip { position: absolute; top: 0; height: 100%; border-radius: 6px; background: var(--clip) center / auto 100% repeat-x;
        border: 2px solid #0000; overflow: hidden; cursor: grab; box-shadow: inset 0 0 0 1px #fff3; }
.clip.sel { border-color: var(--clip-sel); }
.clip.drop { box-shadow: -4px 0 0 var(--clip-sel); }
.clip b { position: absolute; left: 4px; top: 3px; right: 4px; font-size: 12px; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip small { position: absolute; left: 4px; bottom: 3px; font-size: 11px; text-shadow: 0 1px 2px #000; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--head); pointer-events: none; }
.playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--head); }
.empty-tl { padding: 30px; color: var(--ed-muted); }

/* --- отладочный «язычок» --- */
.dbg { position: fixed; top: 60px; right: 0; bottom: 12px; width: min(440px, 92vw); transform: translateX(100%);
       transition: transform .2s; z-index: 50; display: flex; }
.dbg.open { transform: none; }
.dbg-tab { position: absolute; left: -34px; top: 40%; width: 34px; padding: 12px 0; writing-mode: vertical-rl;
           transform: rotate(180deg); border-radius: 0 8px 8px 0; background: var(--accent); border: 0; font-size: 13px; }
.dbg-body { flex: 1; display: flex; flex-direction: column; background: #101013f2; color: var(--ed-text);
            border: 1px solid var(--ed-line); border-right: 0; border-radius: 10px 0 0 10px; padding: 10px; gap: 8px;
            backdrop-filter: blur(6px); min-width: 0; }
.dbg-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dbg-head button { background: #ffffff14; border-color: #ffffff22; }
.dbg-feed { flex: 1; overflow: auto; font: 13px/1.4 ui-monospace, Menlo, monospace; display: flex; flex-direction: column; gap: 6px; }
.dbg-feed .e { padding: 6px 8px; border-radius: 6px; background: #ffffff0a; white-space: pre-wrap; word-break: break-word; }
.dbg-feed .e.me { background: #2f6fde33; align-self: flex-end; max-width: 90%; }
.dbg-feed .e.ok { border-left: 3px solid var(--ok); }
.dbg-feed .e.err { border-left: 3px solid var(--err); }
.dbg-feed .e.voice { border-left: 3px solid #b98cff; }
.dbg-feed .e.sys { color: var(--ed-muted); }
.dbg-feed .e pre { margin: 4px 0 0; font-size: 11px; color: var(--ed-muted); white-space: pre-wrap; }
.dbg-input { display: flex; gap: 6px; }
.dbg-input input { flex: 1; }
.mic { background: #ffffff14; border-color: #ffffff22; font-size: 16px; padding: 4px 10px; }
.mic.rec { background: var(--err); border-color: var(--err); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.dbg-help ul { margin: 6px 0; padding-left: 18px; }
.dbg-help code { color: #9fc0ff; }

@media (max-width: 800px) {
  .editor { grid-template-columns: 1fr; grid-template-rows: auto minmax(220px, 45vh) 200px; height: auto; }
  .bin-pane { grid-row: auto; max-height: 220px; }
  .timeline-pane { grid-column: auto; }
}
